Visible light water surface target detection method based on sea level constraint and hierarchical generative attention

By employing sea level constraints and a hierarchical generative attention method, the problems of insufficient background interference suppression and lack of dense occlusion features in visible light water surface target detection are solved, achieving efficient water surface target recognition and improving the accuracy and completeness of detection.

CN121640183AActive Publication Date: 2026-03-10CHINA WATERBORNE TRANSPORT RES INST
View PDF 11 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-17
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

Existing visible light water surface target detection schemes do not fully utilize the unique physical prior laws of water surface scenes, resulting in insufficient background interference suppression, easy introduction of false features by frequency domain transformation, loss of target features due to dense occlusion, high false detection rate of background, and poor target recognition performance in densely occluded scenes.

Method used

Sea level curves are located through scene semantic segmentation, water surface candidate areas and non-water surface exclusion areas are divided, adaptive Gaussian filtering is performed to suppress static ripple interference, a hierarchical generative attention architecture is constructed, global and local attention layers are used to enhance small target features, conditional generative adversarial network is called to complete the texture of overlapping areas, a complete target feature map is generated, and matching is performed based on dynamic anchor boxes.

Benefits of technology

It effectively reduces the false detection rate of background, improves the recognition of small targets and the completeness and accuracy of target recognition in densely occluded scenes, avoids the false feature problem caused by frequency domain transformation, and improves the detection performance of complex water surface scenes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121640183A_ABST
    Figure CN121640183A_ABST
Patent Text Reader

Abstract

The invention discloses a visible light water surface target detection method and device based on sea level constraint and hierarchical generative attention, and the method comprises the steps: obtaining a visible light water surface scene image, and carrying out the preprocessing of the visible light water surface scene image, and obtaining a preprocessed water surface image, image frequency domain high-frequency features are extracted from the preprocessed water surface image, spatial domain high-frequency enhancement features are generated according to the image frequency domain high-frequency features, spatial domain global local features are extracted from the preprocessed water surface image to be fused with the image frequency domain high-frequency features, and then double-domain fusion features are generated; target edge details are extracted from the double-domain fusion features to obtain shallow small target features, global semantic association analysis is carried out to obtain deep global association features, the deep global association features are combined with the shallow small target features, and multi-scale target candidate features are generated; eliminating interference candidates from the multi-scale target candidate features to generate an initial target detection result; and performing overlapping target decoupling processing on the initial target detection result to obtain an overlapping target candidate pair so as to generate a final visible light water surface target detection result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer vision detection technology, and more specifically, to a visible light water surface target detection method based on sea level constraints and hierarchical generative attention. Background Technology

[0002] In scenarios such as smart ocean, maritime security and environmental monitoring, visible light surface target detection is a core technology. Its core requirement is to accurately identify targets such as ships, buoys and floating objects in complex water surface scenarios that include wave interference, strong light reflection, long-distance small targets and dense obstruction, so as to provide data support for subsequent monitoring, early warning and dispatch management.

[0003] In the existing technology, a typical visible light water surface target detection scheme achieves target detection through a frequency domain fusion strategy. The idea is as follows: first, perform a fast Fourier transform on the visible light water surface scene image to convert the pixel domain information to the frequency domain, filter the target-related high-frequency components and recombine them with low-frequency components, then inversely transform back to the spatial domain, and finally achieve target recognition through feature fusion and detection head.

[0004] The scheme has obvious technical drawbacks: it does not utilize the unique physical prior laws of water surface scenes, it is insufficient in suppressing background interference in non-target areas such as the sky and shoreline, and the frequency domain transformation process is prone to introducing false features. Furthermore, it lacks an effective mechanism to repair the feature loss problem of densely occluded targets, resulting in a high background false detection rate for target detection and poor target recognition performance in densely occluded scenes. Summary of the Invention

[0005] To address the aforementioned technical problems, this application provides a visible light water surface target detection method based on sea level constraints and hierarchical generative attention, which can at least alleviate the aforementioned technical problems.

[0006] The technical solutions provided in this application are as follows: A visible light water surface target detection method based on sea level constraints and hierarchical generative attention includes the following steps: Step 1: Obtain a visible light water surface scene image, perform scene semantic segmentation on it to locate the sea level curve, divide the water surface candidate area and the non-water surface exclusion area, and obtain the water surface focused image after filtering the non-water surface exclusion area. Step 2: Perform adaptive Gaussian filtering on the water surface focused image to suppress static ripple interference, and then extract the dynamic region through inter-frame difference to generate a dynamic target mask. Combine the dynamic target mask to separate the dynamic target region from the water surface focused image. Step 3: Construct a hierarchical generative attention architecture. First, perform global association calculation on the dynamic target region through the global attention layer to filter out small target candidate boxes. Then, enhance the edge texture features of the corresponding regions of the small target candidate boxes through the local attention layer to generate a hierarchical attention feature map. Step 4: For overlapping candidate boxes in the hierarchical attention feature map that exceed the IoU threshold, call the conditional generative adversarial network to fill in the missing texture of the overlapping area based on the features of the non-overlapping area, and generate a complete target feature map. Step 5: Match the complete target feature map with the adapted anchor boxes generated by the dynamic anchor box generator, and output the target category, bounding box and confidence score through classification branch and regression branch to obtain the visible light water surface target detection result.

[0007] Optionally, step 1 includes: Step 11: Input the visible light water surface scene image into the lightweight semantic segmentation network and output three semantic label maps: water surface, sky, and shoreline; Step 12: Perform Hough transform fitting on the water-sky and water-shoreline boundaries in the semantic label map to obtain the sea level curve; Step 13: Using the sea level curve as the boundary, mark the area below the curve as the water surface candidate area, and mark the area above and along the shoreline as the non-water surface exclusion area. After cropping the non-water surface exclusion area, generate a water surface focused image. The water surface focused image only retains the pixel information of the water surface candidate area.

[0008] Optionally, step 11 includes: Step 111: Perform pixel-level grayscale statistics on the visible light water surface scene image to generate a grayscale distribution histogram; Step 112: Determine the initial segmentation threshold of the semantic segmentation network based on the gray-level distribution histogram, and input it into the feature extraction layer of the lightweight semantic segmentation network; Step 113: Output multi-scale semantic features through the feature extraction layer, and after upsampling and pixel classification layer processing, generate three types of semantic label maps: water surface, sky, and shoreline. Each pixel in the semantic label map corresponds to a scene label.

[0009] Optionally, step 12 includes: Step 121: Traverse the semantic label graph and extract the pixel coordinates of the water surface-sky and water surface-shoreline boundary lines to form a boundary line pixel set; Step 122: Perform Hough transform on the boundary line pixel set to fit multiple candidate straight lines; Step 123: Calculate the overlap between the candidate straight line and the water surface area in the semantic label image, and select the candidate straight line with the highest overlap as the sea level curve. The pixel coordinates of the sea level curve cover the core area of ​​the boundary pixel set.

[0010] Optionally, step 2 includes: Step 21: Calculate the gray-level variance of each pixel block in the water surface focused image, and dynamically adjust the Gaussian filter kernel size according to the gray-level variance. Use a small-sized filter kernel for areas with high gray-level variance and a large-sized filter kernel for areas with low gray-level variance. After filtering, generate a ripple-suppressed image. Step 22: Obtain the previous frame image of the water surface focused image, calculate the gray level difference of corresponding pixels in the two frames, set an adaptive threshold to filter pixels whose gray level difference exceeds the threshold, and generate a dynamic region mask. Step 23: Perform a pixel-level AND operation on the dynamic region mask and the ripple suppression image to separate the dynamic target region. Only pixels that simultaneously satisfy ripple suppression and dynamic characteristics are retained in the dynamic target region.

[0011] Optionally, step 21 includes: Step 211: Divide the water surface focused image into multiple pixel blocks according to a preset size, and calculate the grayscale variance of each pixel block; Step 212: Set the grayscale variance threshold range. When the grayscale variance of a pixel block is higher than the upper limit of the range, the filter kernel size is set to the first preset value. When it is lower than the lower limit of the range, it is set to the second preset value. When it is within the range, it is set to the third preset value. Step 213: Perform Gaussian filtering of the corresponding size on each pixel block, and stitch the filtered pixel blocks together to generate a ripple-suppressed image. The grayscale fluctuation amplitude of static ripples in the ripple-suppressed image is reduced.

[0012] Optionally, step 3 includes: Step 31: Construct a global attention layer, perform global association weight calculation on the pixel features of the dynamic target region, strengthen the pixel response of the target region, weaken the pixel response of the background region, and output a global feature map; Step 32: Set a threshold for generating candidate boxes based on the pixel response intensity of the global feature map, and select regions with response intensity exceeding the threshold as small target candidate boxes. The size of the small target candidate boxes is adapted to the size of the small targets in the dynamic target region. Step 33: Construct a local attention layer, perform convolution and channel attention calculation on the corresponding regions of small target candidate boxes, enhance target edge and texture features, generate a hierarchical attention feature map, and fuse global correlation information and local detail features in the hierarchical attention feature map.

[0013] Optionally, step 31 includes: Step 311: Convert the feature map of the dynamic target region into feature vectors, calculate the cosine similarity between any two feature vectors, and obtain the global correlation matrix; Step 312: Perform row normalization on the global correlation matrix to obtain the global attention weight matrix; Step 313: Weight the global attention weight matrix and the feature map of the dynamic target region pixel by pixel to generate a global feature map. The feature response value of the target region in the global feature map is higher than that of the background region.

[0014] Optionally, step 4 includes: Step 41: Calculate the IoU between small target candidate boxes in the hierarchical attention feature map. Candidate boxes with IoU higher than a preset overlap threshold are marked as overlapping candidate box pairs. Step 42: Extract the non-overlapping region features of overlapping candidate box pairs and input them into the generator of the conditional generative adversarial network; Step 43: The generator generates a texture to complete the overlapping area based on the edge direction and texture pattern of the non-overlapping area features. The discriminator verifies the consistency between the completed texture and the real non-overlapping features. After iterative optimization, a complete target feature map is obtained. The texture of the overlapping area in the complete target feature map is continuous and matches the target shape.

[0015] Optionally, step 42 includes: Step 421: Crop the features of the non-overlapping regions in the overlapping candidate box pairs, extract feature parameters such as edge gradient and texture direction, and form a non-overlapping feature vector; Step 422: Input the non-overlapping feature vectors into the generator of the conditional generative adversarial network. The generator gradually restores the feature map resolution through transposed convolutional layers and outputs the initial completed texture of the overlapping region. Step 423: The discriminator receives the initial completed texture and non-overlapping region features, outputs the true / false determination probability, and the generator adjusts the parameters according to the determination probability until the determination probability approaches the preset threshold to obtain the final completed texture.

[0016] Optionally, step 5 includes: Step 51: Construct a dynamic anchor frame generator. Based on historical water surface target size statistics, generate multiple sets of anchor frame sizes and aspect ratios that are adapted to ships, buoys, and floating objects through density clustering, forming a scene-adaptive anchor frame set. Step 52: Perform IoU matching between the complete target feature map and the scene-adapted anchor box set, and filter out positive sample anchor boxes; Step 53: Perform category determination on the positive sample anchor boxes through the classification branch, and fine-tune the position and size of the positive sample anchor boxes through the regression branch. Output the target category, bounding box and confidence score to obtain the visible light water surface target detection results.

[0017] Optionally, step 51 includes: Step 511: Collect historical surface target detection data, count the length and width pixel values ​​of ships, buoys, and floating objects, and generate a target size distribution table; Step 522: Perform density clustering on the data in the target size distribution table to obtain several sets of core sizes; Step 513: Based on the physical form of different target types, assign an appropriate aspect ratio to each core size group to form a scene adaptation anchor frame set. The proportion of small-sized anchor frames in the scene adaptation anchor frame set shall not be less than the set ratio threshold.

[0018] The technical solution provided in this application has the following technical advantages: By locating the sea level curve through scene semantic segmentation, dividing the water surface candidate area into the non-water surface exclusion area and filtering the non-water surface exclusion area, the detection range is narrowed by directly utilizing the physical prior rules unique to the water surface scene. This suppresses background interference from non-target areas such as the sky and shoreline from the scene level rather than the simple feature level. Compared with the traditional frequency domain fusion scheme that does not utilize physical priors, this significantly reduces the possibility of background false detection, allowing the subsequent detection process to focus more on the target area of ​​the water surface.

[0019] An adaptive Gaussian filter is applied to the focused water surface image, dynamically adjusting the filter kernel size based on the gray-level variance to specifically suppress static ripple interference. Then, dynamic regions are extracted through inter-frame differencing and a dynamic target mask is generated to separate the dynamic target regions. This processing method abandons the frequency domain transformation process that easily introduces spurious features in traditional schemes. It utilizes temporal correlation to accurately screen dynamic targets, ensuring both effective suppression of static interference and reducing the impact of spurious features on subsequent detection, resulting in purer features in the dynamic target regions.

[0020] A hierarchical generative attention architecture is constructed. First, a global attention layer performs global correlation calculations on dynamic target regions to quickly filter out small target candidate boxes. Then, a local attention layer enhances the edge texture features of the corresponding regions of the small target candidate boxes, generating hierarchical attention feature maps. This hierarchical processing method not only achieves rapid localization of small targets but also compensates for the lack of detail in small target features. Compared with the single feature processing of small targets in traditional solutions, it significantly improves the recognition accuracy of small target features.

[0021] For overlapping candidate boxes in the hierarchical attention feature map with IoU exceeding the threshold, a conditional generative adversarial network is invoked to complete the missing texture in the overlapping region based on the features of the non-overlapping region, generating a complete target feature map. This process specifically addresses the feature loss problem of densely occluded targets, repairing broken features through a generative completion mechanism. Compared to the shortcomings of traditional solutions that lack occlusion repair mechanisms, it effectively improves the completeness and accuracy of target recognition in densely occluded scenes.

[0022] The detection results are output by matching the complete target feature map with the adapted anchor frames generated by the dynamic anchor frame generator, and by using classification and regression branches. The anchor frames generated by the dynamic anchor frame generator are adapted to the size and aspect ratio of different types of targets such as ships, buoys, and floating objects. Compared with traditional fixed anchor frames, the matching accuracy is higher, further ensuring the overall effect of target detection.

[0023] Compared with traditional visible light water surface target detection schemes, the scheme in this application solves the problem of high false detection rate of traditional schemes by combining "physical prior guidance + temporal interference suppression + generative occlusion completion". It also improves the shortcomings of poor detection effect of dense occlusion and small target, while avoiding the introduction of false features caused by frequency domain transformation, thus showing better detection performance in complex water surface scenes. Attached Figure Description

[0024] Figure 1 This application provides an embodiment of a visible light water surface target detection method based on sea level constraints and hierarchical generative attention.

[0025] Figure 2 This application provides an embodiment of a visible light water surface target detection device based on sea level constraints and hierarchical generative attention.

[0026] Figure 3 This is an electronic device according to an embodiment of the present application. Detailed Implementation

[0027] like Figure 1 As shown in the figure, this application provides a visible light water surface target detection method based on sea level constraints and hierarchical generative attention, including the following steps: Step 1: Obtain a visible light water surface scene image, perform scene semantic segmentation on it to locate the sea level curve, divide the water surface candidate area and the non-water surface exclusion area, and obtain the water surface focused image after filtering the non-water surface exclusion area. Step 2: Perform adaptive Gaussian filtering on the water surface focused image to suppress static ripple interference, and then extract the dynamic region through inter-frame difference to generate a dynamic target mask. Combine the dynamic target mask to separate the dynamic target region from the water surface focused image. Step 3: Construct a hierarchical generative attention architecture. First, perform global association calculation on the dynamic target region through the global attention layer to filter out small target candidate boxes. Then, enhance the edge texture features of the corresponding regions of the small target candidate boxes through the local attention layer to generate a hierarchical attention feature map. Step 4: For overlapping candidate boxes in the hierarchical attention feature map that exceed the IoU threshold, call the conditional generative adversarial network to fill in the missing texture of the overlapping area based on the features of the non-overlapping area, and generate a complete target feature map. Step 5: Match the complete target feature map with the adapted anchor boxes generated by the dynamic anchor box generator, and output the target category, bounding box and confidence score through classification branch and regression branch to obtain the visible light water surface target detection result.

[0028] Optionally, step 1 includes: Step 11: Input the visible light water surface scene image into the lightweight semantic segmentation network and output three semantic label maps: water surface, sky, and shoreline; Step 12: Perform Hough transform fitting on the water-sky and water-shoreline boundaries in the semantic label map to obtain the sea level curve; Step 13: Using the sea level curve as the boundary, mark the area below the curve as the water surface candidate area, and mark the area above and along the shoreline as the non-water surface exclusion area. After cropping the non-water surface exclusion area, generate a water surface focused image. The water surface focused image only retains the pixel information of the water surface candidate area.

[0029] Optionally, step 11 includes: Step 111: Perform pixel-level grayscale statistics on the visible light water surface scene image to generate a grayscale distribution histogram; Step 112: Determine the initial segmentation threshold of the semantic segmentation network based on the gray-level distribution histogram, and input it into the feature extraction layer of the lightweight semantic segmentation network; Step 113: Output multi-scale semantic features through the feature extraction layer, and after upsampling and pixel classification layer processing, generate three types of semantic label maps: water surface, sky, and shoreline. Each pixel in the semantic label map corresponds to a scene label.

[0030] This application addresses the problem of insufficient semantic segmentation accuracy caused by large illumination variations and easy confusion between the grayscale of the water surface and the sky / shoreline in visible light water surface scenes. It designs grayscale statistics and threshold determination logic adapted to water surface scenes, and constructs a lightweight semantic segmentation network with scene-specific feature extraction. Through multi-scale feature fusion and accurate pixel classification, it achieves efficient differentiation of three types of scenes: water surface, sky, and shoreline. This provides a high-purity semantic label foundation for subsequent sea level curve localization. Unlike traditional general semantic segmentation methods, this approach is more in line with the pixel distribution characteristics and segmentation requirements of water surface scenes.

[0031] Preferably, the specific implementation process of step 111 is as follows: The visible light water surface scene image obtained in step 1 is converted into a single-channel grayscale image by performing channel conversion, ensuring that each pixel retains only one grayscale value (range 0-255). The grayscale image is traversed pixel-by-pixel at preset grayscale level intervals (e.g., one grayscale level is one interval), and the number of pixels corresponding to each grayscale level is counted. Simultaneously, the horizontal and vertical distribution range of each grayscale level in the image is recorded, generating a grayscale distribution histogram containing the grayscale level, the corresponding number of pixels, and the distribution range. For grayscale anomalies caused by strong light reflection and shadow areas that may exist in the water surface scene, the grayscale distribution histogram is smoothed. An isolated grayscale anomaly peak is removed using a sliding window averaging method, retaining effective peaks that reflect the core grayscale characteristics of the water surface, sky, and shoreline, resulting in a smoothed grayscale distribution histogram. This histogram more accurately reflects the grayscale distribution patterns of the three types of scenes.

[0032] Preferably, in the specific technical implementation of step 112: peak detection is performed on the smoothed grayscale distribution histogram to identify three significant grayscale peaks, corresponding to the core grayscale values ​​of the three scenes: sky, water surface, and shoreline. The valley point between two adjacent core grayscale values ​​is calculated, and the grayscale value corresponding to the valley point is used as the initial segmentation reference threshold, resulting in two initial segmentation reference thresholds T1 and T2 (assuming T1 < T2). Based on the physical characteristics of the water surface scene, the initial segmentation reference thresholds are dynamically adjusted. The grayscale value of the sky scene is usually higher than that of the water surface and shoreline, so the grayscale range higher than T2 is initially classified as the sky candidate grayscale area; the grayscale value of the shoreline scene is mostly in the middle range, so the grayscale range between T1 and T2 is classified as the shoreline candidate grayscale area; the grayscale value of the water surface scene is relatively low, so the grayscale range lower than T1 is classified as the water surface candidate grayscale area. Calculate the gray-level variance of pixels in each candidate gray-level region. If the gray-level variance of a candidate gray-level region exceeds the set variance threshold (e.g., 30), then find the second lowest value point in that candidate gray-level region again and add a segmentation threshold to ensure that the gray-level fluctuation within the gray-level region corresponding to each scene is small. Finally, determine an optimal set of initial segmentation thresholds and input the initial segmentation threshold set into the feature extraction layer of the designed lightweight semantic segmentation network to provide a targeted gray-level constraint basis for feature extraction.

[0033] Preferably, in a given scenario, step 113 is specifically implemented as follows: A feature extraction layer of a lightweight semantic segmentation network is constructed. This feature extraction layer contains four sequentially connected depthwise separable convolutional blocks. Each depthwise separable convolutional block consists of a depthwise convolutional layer, a pointwise convolutional layer, and a batch normalization layer. The depthwise convolutional layer is used to extract spatial features of pixels, the pointwise convolutional layer is used to fuse channel features, and the batch normalization layer is used to accelerate network convergence. The visible light water surface scene image and the initial segmentation threshold set are simultaneously input into the feature extraction layer. The first depthwise separable convolutional block uses a large kernel size (e.g., 7×7) and a stride of 2, outputting a low-resolution global feature map. The subsequent three depthwise separable convolutional blocks sequentially reduce the kernel size (e.g., 5×5, 3×3, 3×3), with each stride set to 1, progressively extracting medium- to high-resolution detail feature maps, ultimately outputting four semantic feature maps at different scales. A multi-scale feature fusion module is designed, employing a combination of upsampling and lateral connections. The low-resolution global feature map is upsampled to the same size as the high-resolution detail feature map using bilinear interpolation, and then pixel-level addition and fusion are performed to preserve global scene information and local detail features, generating a fused multi-scale semantic feature map. This fused multi-scale semantic feature map is then input into a pixel classification layer. The pixel classification layer uses the Softmax activation function to calculate the class probability of each pixel's feature vector, outputting the probability value of the pixel belonging to one of three scene categories: sky, water, or shoreline. The category with the highest probability value is used as the final scene label for that pixel, generating semantic label maps for water, sky, and shoreline.

[0034] Optionally, step 12 includes: Step 121: Traverse the semantic label graph and extract the pixel coordinates of the water surface-sky and water surface-shoreline boundary lines to form a boundary line pixel set; Step 122: Perform Hough transform on the boundary line pixel set to fit multiple candidate straight lines; Step 123: Calculate the overlap between the candidate straight line and the water surface area in the semantic label image, and select the candidate straight line with the highest overlap as the sea level curve. The pixel coordinates of the sea level curve cover the core area of ​​the boundary pixel set.

[0035] This application addresses the issues of semantic label map boundaries being susceptible to noise interference in visible light water surface scenes, insufficient accuracy of traditional Hough transform fitting, and poor adaptability of sea level curve positioning to water surface areas. It designs scene-specific boundary line extraction logic, a noise-resistant Hough transform fitting method, and a region adaptability screening mechanism. By accurately extracting boundary line pixels, fitting candidate lines under multiple constraints, and selecting the optimal curve based on the overlap of water surface areas, it achieves precise positioning of sea level curves. Unlike traditional general line fitting methods, this approach better fits the boundary line characteristics of water surface scenes and the needs of sea level positioning, providing a reliable basis for subsequent water surface candidate area division.

[0036] Preferably, the specific implementation process of step 121 is as follows: The semantic label maps of water surface, sky, and shoreline generated in step 11 are traversed pixel by pixel in a left-to-right, top-to-bottom order, recording the coordinates (x, y) of each pixel and its corresponding scene label. A dual-neighborhood verification rule is designed: for the currently traversed pixel, the scene labels of pixels within its 8-neighborhood are detected. If the current pixel label is water surface, and there are pixels with sky or shoreline labels within its 8-neighborhood, then this pixel is marked as a candidate boundary line pixel; similarly, if the current pixel label is sky or shoreline, and there are pixels with water surface labels within its 8-neighborhood, these are also marked as candidate boundary line pixels. Connectivity analysis is performed on the candidate boundary line pixel set. A distance clustering method based on pixel coordinates is used to group candidate boundary line pixels with a spatial distance less than a set threshold (e.g., 3 pixels) into the same connected component, and isolated single candidate boundary line pixels are removed (these pixels are mostly caused by semantic segmentation noise). The remaining candidate boundary line pixels are classified according to their neighborhood label type into a water-sky boundary line pixel subset and a water-shoreline boundary line pixel subset. The two subsets are merged to form the final boundary line pixel set, which accurately covers the core pixel region of the two types of real boundaries.

[0037] Preferably, in the specific technical implementation of step 122: a Hough transform parameter space adapted to the features of the water surface boundary line is constructed. The polar angle θ range of the parameter space is set to an interval that matches the common sea level tilt angle in water surface scenes (e.g., -10° to 10°), and the polar radius ρ range covers the diagonal length of the semantic tag map, ensuring that all possible sea level straight lines can be mapped in the parameter space. For each pixel coordinate (x, y) in the boundary line pixel set, all possible ρ values ​​are calculated within the corresponding θ range in the parameter space. For each (θ, ρ) parameter pair, an accumulation count is performed to generate a Hough accumulation matrix. The rows of this matrix correspond to the polar angle θ, the columns correspond to the polar radius ρ, and the matrix element values ​​represent the number of boundary line pixels traversed by the straight line corresponding to the (θ, ρ) parameter pair. To suppress the interference of residual noise from semantic segmentation on the Hough transform, a dynamic threshold filtering mechanism is designed. The mean and standard deviation of the elements in the Hough accumulation matrix are calculated. The sum of the mean and a preset multiple (e.g., 2 times) of the standard deviation is used as the accumulation threshold. (θ, ρ) parameter pairs with element values ​​higher than the accumulation threshold are selected, with each parameter pair corresponding to a candidate line. The selected candidate lines are deduplicated. The parameter difference between any two candidate lines is calculated. If the polar angle difference is less than a set angle threshold (e.g., 1°) and the polar radius difference is less than a set distance threshold (e.g., 5 pixels), the candidate line with the higher accumulation value is retained. This process ultimately yields multiple non-overlapping candidate lines that cross a significant number of boundary pixels.

[0038] Preferably, in a scenario, step 123 is specifically implemented as follows: traverse each candidate line and calculate the set of pixel coordinates of the line in the semantic label map based on its corresponding (θ, ρ) parameters, that is, all pixel coordinates (x, y) on the line that satisfy xcosθ+ysinθ=ρ. For each candidate line, count the number of pixels in its pixel coordinate set that belong to the water surface region of the semantic label map, denoted as the number of overlapping pixels; at the same time, count the total number of pixels in the pixel coordinate set of the line, denoted as the total number of pixels. Calculate the ratio of the number of overlapping pixels to the total number of pixels as the overlap index between the candidate line and the water surface region. This index reflects whether the candidate line fits the actual boundary of the water surface region. Considering the slight height difference that may exist between the water surface-sky and water surface-shoreline boundary lines, further calculate the matching degree between each candidate line and the boundary line pixel set. Count the number of pixels in the boundary line pixel set that are within a set range (e.g., 2 pixels) near the line, denoted as the number of matching pixels. Calculate the ratio of the number of matching pixels to the total number of pixels in the boundary line pixel set as the matching degree index. The overlap and matching indices are weighted and summed according to preset weights (e.g., overlap weight 0.7, matching weight 0.3) to obtain a comprehensive score for each candidate line. The candidate line with the highest comprehensive score is selected as the sea level curve. The pixel coordinates of this sea level curve not only cover the core area of ​​the boundary pixel set, but also maintain a high degree of overlap with the water surface area in the semantic label map, ensuring that the subsequent water surface candidate areas have high accuracy.

[0039] This application addresses the issue of insufficient purity in water surface candidate areas caused by traditional region segmentation methods in visible light water surface scenes, where non-water surface interference areas such as shoreline protrusions and near-shore fixed facilities may exist below the sea level curve. A scene-specific region labeling logic and secondary purification mechanism are designed to achieve high-purity extraction of water surface candidate areas. This differs from traditional methods that simply segment regions according to curves, and better reflects the complex terrain and semantic distribution characteristics of water surface scenes, providing high-quality focused areas for subsequent dynamic interference suppression and target detection.

[0040] Preferably, the specific implementation process of step 13 is as follows: Obtain the sea level curve obtained in step 12 and the three types of semantic label maps generated in step 11. First, construct the collaborative labeling rules between semantic labels and the sea level curve. For each pixel in the semantic label map, perform preliminary labeling based on the positional relationship between its coordinates (x, y) and the sea level curve. If the vertical coordinate y of the pixel is greater than the vertical coordinate of the sea level curve at the horizontal coordinate x, it is labeled as a water surface candidate pixel; if the vertical coordinate y of the pixel is less than the vertical coordinate of the sea level curve at the horizontal coordinate x, or the semantic label of the pixel is shoreline, it is labeled as a non-water surface excluded pixel. Generate preliminary water surface candidate area masks and non-water surface excluded area masks. In the water surface candidate area mask, only water surface candidate pixels are labeled as 1, and the rest are 0; the non-water surface excluded area mask is the opposite. Perform connected component analysis on the preliminary water surface candidate area mask. Use a clustering method based on pixel coordinates to divide spatially continuous water surface candidate pixels into multiple connected components, and calculate the area and semantic purity (the proportion of water surface label pixels in the connected component). Set a connected component area threshold (e.g., 500 pixels) and a semantic purity threshold (e.g., 90%) to remove connected components with an area smaller than the area threshold or a semantic purity lower than the semantic purity threshold (these connected components are mostly shoreline fragments or non-water surface areas caused by semantic segmentation noise). Update the water surface candidate area mask and the non-water surface exclusion area mask, removing the pixels corresponding to the removed connected components from the water surface candidate area mask and adding them to the non-water surface exclusion area mask. Based on the updated water surface candidate area mask, perform pixel-level cropping on the original visible light water surface scene image, retaining the pixel information marked as 1 in the mask, and removing the pixels marked as 1 in the non-water surface exclusion area mask to generate a water surface focused image. This water surface focused image only contains high-purity water surface area pixels, effectively eliminating non-water surface interference.

[0041] Optionally, step 2 includes: Step 21: Calculate the gray-level variance of each pixel block in the water surface focused image, and dynamically adjust the Gaussian filter kernel size according to the gray-level variance. Use a small-sized filter kernel for areas with high gray-level variance and a large-sized filter kernel for areas with low gray-level variance. After filtering, generate a ripple-suppressed image. Step 22: Obtain the previous frame image of the water surface focused image, calculate the gray level difference of corresponding pixels in the two frames, set an adaptive threshold to filter pixels whose gray level difference exceeds the threshold, and generate a dynamic region mask. Step 23: Perform a pixel-level AND operation on the dynamic region mask and the ripple suppression image to separate the dynamic target region. Only pixels that simultaneously satisfy ripple suppression and dynamic characteristics are retained in the dynamic target region.

[0042] Optionally, step 21 includes: Step 211: Divide the water surface focused image into multiple pixel blocks according to a preset size, and calculate the grayscale variance of each pixel block; Step 212: Set the grayscale variance threshold range. When the grayscale variance of a pixel block is higher than the upper limit of the range, the filter kernel size is set to the first preset value. When it is lower than the lower limit of the range, it is set to the second preset value. When it is within the range, it is set to the third preset value. Step 213: Perform Gaussian filtering of the corresponding size on each pixel block, and stitch the filtered pixel blocks together to generate a ripple-suppressed image. The grayscale fluctuation amplitude of static ripples in the ripple-suppressed image is reduced.

[0043] This application addresses the issues of uneven grayscale fluctuations in static ripples in visible light water surface scenes and the tendency of traditional fixed-kernel Gaussian filtering to blur target details or incompletely suppress ripples. It designs a pixel block partitioning logic adapted to water surface scenes, a dynamic threshold range determination method, and a targeted filtering strategy. By partitioning pixel blocks according to scene characteristics, accurately matching the filter kernel size with ripple intensity, and optimizing the inter-block stitching transition, it achieves efficient suppression of static ripples and complete preservation of target details. Unlike traditional general filtering methods, it is more in line with the ripple distribution characteristics and target detection requirements of water surface scenes.

[0044] Preferably, the specific implementation process of step 211 is as follows: Obtain the water surface focused image generated in step 13. This image only contains pixels of the high-purity water surface area and may contain static ripples of different intensities. Dynamically determine the pixel block size according to the resolution of the water surface focused image to ensure that each pixel block can cover the complete local ripple unit without missing small target details. For example, when the image resolution is 1920×1080 pixels, the pixel block size is set to 8×8 to 32×32 pixels (e.g., 16×16 pixels). Divide the water surface focused image into non-overlapping sections in order from left to right and from top to bottom. If the remaining pixels at the image edge are less than a complete pixel block, merge the remaining pixels with adjacent complete pixel blocks to generate several water surface pixel blocks of the same size. For each water surface pixel block, the grayscale values ​​are iterated, the mean of the grayscale values ​​of all pixels in the pixel block is calculated, and then the sum of squared deviations between the grayscale values ​​of each pixel and the mean is calculated using the mean. Finally, the grayscale variance of each water surface pixel block is obtained. This grayscale variance directly reflects the static ripple intensity of the corresponding area. The higher the variance, the more obvious the ripples.

[0045] Preferably, in the specific technical implementation of step 212: A large number of focused images of different water surface scenes (such as oceans, lakes, and inland rivers) are collected, and the distribution range of their pixel block grayscale variance is statistically analyzed. A grayscale variance interval covering more than 95% of the scene is determined as the baseline interval. A dynamic threshold interval is designed based on the baseline interval, with 70%-80% of the baseline interval as the lower limit and 90%-95% as the upper limit, forming a grayscale variance threshold interval. Three sets of filter kernel sizes are set as the first, second, and third preset values. The first preset value is a small-sized filter kernel (e.g., 3×3 pixels), adapted to areas with high grayscale variance and obvious ripples, avoiding over-filtering and blurring of target details; the second preset value is a large-sized filter kernel (e.g., 7×7 pixels), adapted to areas with low grayscale variance and smooth ripples, enhancing the ripple suppression effect; the third preset value is a medium-sized filter kernel (e.g., 5×5 pixels), adapted to areas with grayscale variance within the threshold interval, balancing ripple suppression and detail preservation. The grayscale variance of each water surface pixel block is compared with the threshold range to determine the corresponding filter kernel size for each pixel block, and a pixel block-filter kernel size mapping table is generated to provide a basis for subsequent targeted filtering.

[0046] Preferably, the specific implementation process of step 213 is as follows: Based on the pixel block-filter kernel size mapping table, a corresponding Gaussian filter kernel is assigned to each water surface pixel block. The standard deviation of the filter kernel is dynamically adjusted according to the size; small-sized filter kernels correspond to smaller standard deviations (e.g., 0.8-1.2), and large-sized filter kernels correspond to larger standard deviations (e.g., 1.5-2.0), ensuring that the filtering effect matches the ripple intensity. A corresponding Gaussian filtering operation is performed on each water surface pixel block. Through the convolution operation between the filter kernel and the pixel block, the grayscale fluctuations caused by static ripples are smoothed, generating a filtered single pixel block. To avoid obvious filtering traces at the pixel block splicing points, an inter-block transition fusion mechanism is designed. For the overlapping boundary region (e.g., 2-3 pixel width) of two adjacent pixel blocks, a weighted average method is used to fuse the boundary pixel values ​​of the two filtered pixel blocks. The weights transition linearly from inside the block to outside the block, ensuring the grayscale continuity of the spliced ​​image. All filtered and boundary-fused pixel blocks are stitched together in their original division order to generate a complete ripple-suppressed image. The grayscale fluctuation amplitude of static ripples in this image is significantly reduced, while key details such as the edges and textures of the water surface targets are fully preserved.

[0047] This application addresses the problem that static reflections, cloud shadows, and other interferences in visible light water surface scenes are easily confused with dynamic targets, and that traditional fixed-threshold inter-frame difference methods can easily lead to missed detection of dynamic targets or misjudgment of interference. It designs an inter-frame correlation preprocessing, multi-dimensional adaptive threshold generation, and noise-suppressing mask construction logic adapted to water surface scenes. By accurately calculating inter-frame grayscale differences, dynamically matching thresholds with scene characteristics, and removing isolated noise pixels, it achieves efficient extraction of dynamic target regions. Unlike traditional general inter-frame difference methods, this approach better suits the dynamic interference characteristics and target detection needs of water surface scenes, providing high-purity dynamic regions for subsequent attention feature extraction.

[0048] Preferably, the specific implementation process of step 22 is as follows: Obtain the ripple-suppressed image (current frame) generated in step 21 and the ripple-suppressed image of the previous frame. Align the two frames at the pixel level to ensure that the pixel coordinates of the same scene position correspond one-to-one, avoiding differential errors caused by image jitter. Calculate the gray-level difference of corresponding pixels in the two frames to obtain a gray-level difference matrix. The rows and columns of this matrix correspond to the vertical and horizontal pixel coordinates of the image, respectively. The matrix elements are the absolute values ​​of the gray-level differences of the corresponding pixels, directly reflecting the degree of gray-level change at that position between the two frames. An adaptive threshold generation model specifically for water surface scenes is constructed. This model includes a global statistical layer and a local correction layer. The global statistical layer calculates the mean μ and standard deviation σ of the gray-level difference matrix and generates a global baseline threshold based on the dynamic interference intensity of the water surface scene (determined by the texture roughness of the ripple suppression image). When the dynamic interference intensity is high, the global baseline threshold is set to μ+k1σ (k1 is 1.2-1.5, for example, 1.3), and when the dynamic interference intensity is low, it is set to μ+k2σ (k2 is 0.8-1.1, for example, 1.0). The local correction layer divides the gray-level difference matrix into multiple local blocks according to a preset size (e.g., 16×16 pixels), calculates the mean and variance of the gray-level difference of each local block, and locally adjusts the global baseline threshold. When the gray-level difference of a local block fluctuates greatly, the threshold is appropriately increased; when the fluctuation is small, the threshold is appropriately decreased, generating a local adaptive threshold matrix with the same size as the gray-level difference matrix. The grayscale difference matrix is ​​compared pixel-by-pixel with the local adaptive threshold matrix. Pixels with grayscale differences exceeding the corresponding threshold are marked as dynamic candidate pixels, while the rest are marked as static pixels, generating an initial dynamic region mask. Morphological processing is then applied to the initial dynamic region mask. First, an erosion operation is used to remove isolated noisy dynamic candidate pixels (e.g., a 3×3 pixel erosion kernel). Then, a dilation operation is used to restore the complete shape of the dynamic target (e.g., a 3×3 pixel dilation kernel). Finally, a dynamic region mask is generated, which accurately marks the dynamic target region in the water scene and effectively eliminates static interference.

[0049] This application addresses the issues in visible light water surface scenes where dynamic region masks may retain static interference noise, ripple suppression images still exhibit local grayscale fluctuations, and traditional pixel-level operations can easily lead to insufficient purity of dynamic target regions. It designs a scene-specific mask purification mechanism, dual-image collaborative verification logic, and region enhancement strategies. By purifying dynamic masks, accurately performing operations, and strengthening target region features, it achieves high-purity extraction of dynamic target regions. Unlike traditional simple operations, this approach better suits the interference characteristics of water surface scenes and the needs of dynamic target detection, providing high-quality input for subsequent hierarchical attention feature extraction.

[0050] Preferably, the specific implementation process of step 23 is as follows: Obtain the ripple suppression image generated in step 21 and the dynamic region mask generated in step 22. First, perform purification processing on the dynamic region mask to construct a water surface scene-specific mask purification model. This model includes a connected component analysis layer and a noise removal layer. The connected component analysis layer performs connected component clustering on the dynamic pixels in the dynamic region mask, grouping dynamic pixels with a spatial distance less than a set threshold (e.g., 3 pixels) into the same connected component, and calculating the area and morphological complexity of each connected component (determined by the ratio of the bounding rectangle of the connected component to the actual area). The noise removal layer sets a connected component area threshold (e.g., 5 pixels) and a morphological complexity threshold (e.g., 1.5), removing connected components with an area less than the area threshold or a morphological complexity higher than the morphological complexity threshold (these connected components are mostly noise residue from inter-frame differences), generating the purified dynamic region mask. The purified dynamic region mask and the ripple-suppressed image are subjected to a pixel-level AND operation. That is, for each pixel location, if the dynamic region mask is marked as 1 and the gray value of the ripple-suppressed image is within a preset valid range (e.g., 30-220), the gray value of that pixel is retained; otherwise, the pixel gray value is set to 0, generating the initial dynamic target region image. Local feature enhancement is then performed on the initial dynamic target region image using an adaptive contrast adjustment algorithm. The mean gray value of the local neighborhood (e.g., 3×3 pixels) of each pixel is calculated, and the gray value of that pixel is adjusted according to the mean to enhance the gray value difference between the target region and the background. Finally, a dynamic target region is generated, which retains only pixels that simultaneously satisfy the requirements of thorough ripple suppression, significant dynamic characteristics, and clear features.

[0051] This application addresses the problem of small grayscale differences between small targets (such as buoys and small floating objects) on the water surface and the background in the initial dynamic target region image, and the easy blurring of features. It designs a scene-adaptive local neighborhood analysis and dynamic gain adjustment mechanism. Through interval grayscale response, adaptive gain allocation and edge protection constraints, it achieves accurate enhancement of target features. Unlike the traditional fixed parameter contrast algorithm, it is more in line with the grayscale distribution characteristics of the water surface scene. While enhancing the difference between the target and the background, it avoids the amplification of residual noise on the water surface and the distortion of target edges.

[0052] Preferably, in the local feature enhancement step of step 23, the adaptive contrast adjustment algorithm is implemented as follows: An initial dynamic target region image is acquired, and each non-zero grayscale pixel in the image (i.e., the retained dynamic target-related pixels) is traversed. A local neighborhood is defined centered on each pixel. The size of the local neighborhood can be dynamically set according to the target scale (e.g., a 3×3 pixel neighborhood is used for small target regions, and a 5×5 pixel neighborhood is used for medium target regions). The mean grayscale value μ and the standard deviation σ of all pixels within each local neighborhood are calculated. The mean grayscale value μ reflects the overall brightness within the neighborhood, and the standard deviation σ reflects the dispersion of pixel grayscale values ​​within the neighborhood. Both serve as the core basis for contrast adjustment. A grayscale interval division rule specific to the water surface scene is constructed, dividing the mean grayscale value μ of the local neighborhood into a low grayscale interval (e.g., μ < 60), a medium grayscale interval (e.g., 60 ≤ μ ≤ 160), and a high grayscale interval (e.g., μ > 160). Different intervals correspond to different contrast adjustment strategies to adapt to the grayscale distribution characteristics under different lighting conditions in the water surface scene. A dynamic gain calculation model is designed, in which the gain value G is positively correlated with the gray-level standard deviation σ and has a range-based relationship with the gray-level mean μ: In the low gray-level range, the gain value G increases linearly with μ (e.g., G = 0.8 + μ / 200), avoiding excessive enhancement of target features in dark areas that leads to noise amplification; In the medium gray-level range, the gain value G remains stable at a high value (e.g., G = 1.2-1.5), focusing on enhancing the gray-level difference between the target and the background; In the high gray-level range, the gain value G decreases linearly with μ (e.g., G = 2.0 - μ / 200), preventing the loss of target details in bright areas due to over-enhancement. Based on the calculated dynamic gain G, the grayscale value of the current pixel is adjusted. The core logic of the adjustment formula is as follows: if the current pixel grayscale value g is higher than the average grayscale value μ of the neighborhood, then the adjusted grayscale value g' = μ + G × (g - μ) further increases the brightness difference with the surrounding background; if the current pixel grayscale value g is lower than the average grayscale value μ of the neighborhood, then the adjusted grayscale value g' = μ - G × (μ - g) further reduces the brightness difference with the surrounding background; if the current pixel grayscale value g is equal to the average grayscale value μ of the neighborhood, then the grayscale value remains unchanged. To avoid distortion caused by over-sharpening of the target edge, an edge protection constraint mechanism is introduced. The average value of the absolute value of the grayscale difference between the current pixel and all pixels in the neighborhood is calculated. If this average value is greater than a set threshold (e.g., 15), the pixel is determined to be at the target edge position, the dynamic gain G is halved, and the adjustment is performed again to ensure a smooth edge transition. After adjusting all pixels, the image is normalized to grayscale values, limiting the adjusted grayscale values ​​to the range of 0-255. Pixels with adjusted grayscale values ​​below a set effective threshold (e.g., 5) are removed (these pixels are mostly weak noise that is ineffective after adjustment). Finally, a dynamic target region with enhanced local features is generated. The edges and texture features of the target in this region are clearer, the grayscale difference with the background is more obvious, and there is no obvious noise amplification or edge distortion.

[0053] Optionally, step 3 includes: Step 31: Construct a global attention layer, perform global association weight calculation on the pixel features of the dynamic target region, strengthen the pixel response of the target region, weaken the pixel response of the background region, and output a global feature map; Step 32: Set a threshold for generating candidate boxes based on the pixel response intensity of the global feature map, and select regions with response intensity exceeding the threshold as small target candidate boxes. The size of the small target candidate boxes is adapted to the size of the small targets in the dynamic target region. Step 33: Construct a local attention layer, perform convolution and channel attention calculation on the corresponding regions of small target candidate boxes, enhance target edge and texture features, generate a hierarchical attention feature map, and fuse global correlation information and local detail features in the hierarchical attention feature map.

[0054] Optionally, step 31 includes: Step 311: Convert the feature map of the dynamic target region into feature vectors, calculate the cosine similarity between any two feature vectors, and obtain the global correlation matrix; Step 312: Perform row normalization on the global correlation matrix to obtain the global attention weight matrix; Step 313: Weight the global attention weight matrix and the feature map of the dynamic target region pixel by pixel to generate a global feature map. The feature response value of the target region in the global feature map is higher than that of the background region.

[0055] This application addresses the issues of sparse target features, residual background interference, and the tendency of traditional global attention calculations to overlook the correlation characteristics of water surface targets in dynamic target regions in visible light water surface scenes. It designs scene-specific feature vector transformation logic, an anti-interference correlation matrix construction method, and a precise weighted fusion strategy. By preserving key target features, strengthening effective correlations between pixels, and precisely weighting feature maps, it enhances the feature response of target regions and weakens background interference. Unlike traditional general global attention calculation methods, it is more in line with the dynamic target distribution characteristics and feature extraction needs of water surface scenes, providing high-quality global feature support for the accurate selection of small target candidate boxes.

[0056] Preferably, the specific implementation process of step 311 is as follows: Obtain the dynamic target region generated in step 23. This region retains only pixels that satisfy ripple suppression and dynamic characteristics. First, perform feature encoding on the dynamic target region through a convolutional layer to generate a dynamic target feature map. The height H and width W of this feature map correspond to the pixel size of the dynamic target region, and the number of channels C is the feature dimension (e.g., 64-256 channels). Unfold the dynamic target feature map according to pixel position. Each pixel position corresponds to a C-dimensional feature vector, generating a set of pixel feature vectors. The set contains H×W feature vectors. The elements of each feature vector correspond to the feature response value of the pixel in each channel, reflecting the texture, edge, and other characteristics of the pixel. Construct a cosine similarity calculation model specific to the water surface scene. This model introduces a scene adaptation factor, assigning higher weights to the water surface target association channels (such as edge and texture channels) in the feature vector and lower weights to the background association channels, in order to strengthen the similarity calculation between target pixels and weaken the interference between background pixels. Based on this model, the cosine similarity between any two feature vectors in the pixel feature vector set is calculated to obtain the global association matrix. This matrix has (H×W)×(H×W) dimensions. The rows and columns of the matrix correspond to the pixel positions in the dynamic target feature map, and the matrix element values ​​are the similarity between the corresponding two pixels. The higher the value, the closer the feature association between the two pixels, especially highlighting the association between target pixels such as ships and buoys.

[0057] Preferably, in the specific technical implementation of step 312: The global association matrix generated in step 311 is obtained. First, interference suppression processing is performed on the global association matrix in the row direction. The mean and standard deviation of each row element are calculated. Abnormally high similarity values ​​within a row that are greater than the mean plus a preset multiple (e.g., 2 times) of the standard deviation are adjusted to the mean plus a preset multiple of the standard deviation to avoid interference from isolated noise pixels on weight allocation. Row normalization is then performed on the processed global association matrix, dividing each row element by the sum of all elements in that row, so that the sum of each row element is 1, resulting in a global attention weight matrix. The dimension of this global attention weight matrix is ​​consistent with that of the global association matrix. The matrix elements are the attention weights corresponding to two pixels. A higher weight value indicates a higher level of attention from the corresponding row pixel to the column pixel, accurately reflecting the association priority between target pixels on the water surface. For example, the row weight corresponding to a ship outline pixel will tilt towards adjacent outline pixels, strengthening the overall association of the target area.

[0058] Preferably, the specific implementation process of step 313 is as follows: The global attention weight matrix and the dynamic target feature map are adapted for dimensionality. The global attention weight matrix is ​​reshaped into a two-dimensional matrix of (H×W)×(H×W), and the dynamic target feature map is reshaped into a two-dimensional feature matrix of (H×W)×C. The global attention weight matrix and the two-dimensional feature matrix are multiplied by matrix multiplication to obtain a weighted feature matrix. Each row of this matrix corresponds to the weighted feature vector of a pixel in the dynamic target feature map, and the vector elements fuse the feature information of associated pixels. The weighted feature matrix is ​​reshaped into a three-dimensional feature map of H×W×C, i.e., the initial weighted feature map. A feature enhancement module is constructed to perform channel attention calculation on the initial weighted feature map, strengthening the feature response of the target-related channels and weakening the feature response of the background-related channels, generating a global feature map. In this global feature map, the feature response values ​​of target areas such as ships and buoys are higher than those of the background areas, effectively highlighting the global association features of the dynamic targets and providing clear feature support for the subsequent selection of small target candidate boxes.

[0059] This application addresses the problem that sparse features and low response intensity of distant small targets in visible light water surface scenes can easily lead to missed detections of small targets or false detections of the background using traditional fixed threshold screening. It designs scene-specific response intensity analysis logic, dynamic threshold generation mechanism, and candidate box size adaptation strategy. By accurately quantifying pixel response, dynamically matching thresholds with target characteristics, and adaptively adjusting candidate box size, it achieves efficient screening of small target candidate boxes. Unlike traditional general candidate box generation methods, it is more in line with the distribution characteristics and detection needs of small targets in water surface scenes, and provides accurate candidate regions for subsequent local attention feature enhancement.

[0060] Preferably, the specific implementation process of step 32 is as follows: Obtain the global feature map generated in step 31. The feature response value of the target area in the feature map is higher than that of the background area. First, perform pixel-level response intensity statistics on the global feature map, calculate the response intensity value of each pixel (i.e., the feature vector magnitude of the corresponding pixel in the feature map), and obtain the response intensity matrix. The rows and columns of the matrix correspond to the vertical and horizontal pixel coordinates of the global feature map, respectively. The matrix elements are the response intensity values ​​of the corresponding pixels, which directly reflect the possibility of the existence of a target at that location. A dynamic threshold generation model specifically for water surface scenes is constructed. This model includes a global statistics layer, a local correction layer, and a scene adaptation layer. The global statistics layer calculates the mean μ and standard deviation σ of the response intensity matrix, and generates a global baseline threshold based on the proportion of small targets in the water surface scene (determined through historical data statistics, e.g., 85%). When the proportion of small targets is high, the global baseline threshold is set to μ+k1σ (k1 is 0.5-0.8, e.g., 0.6), and when the proportion of small targets is low, it is set to μ+k2σ (k2 is 0.9-1.2, e.g., 1.0). The local correction layer divides the response intensity matrix into multiple sub-divisions according to a preset size (e.g., 16×16 pixels). For each local block, the mean and variance of the response intensity are calculated. The global baseline threshold is locally adjusted: when the overall response intensity of a local block is low (potentially indicating small targets), the threshold is appropriately lowered; when the response intensity of a local block fluctuates greatly, the threshold is appropriately raised. A locally adaptive threshold matrix with the same size as the response intensity matrix is ​​generated. The scene adaptation layer introduces dynamic water surface interference intensity (determined by texture roughness in the ripple suppression image) and performs final calibration on the locally adaptive threshold matrix. When the dynamic interference intensity is high, the threshold is appropriately raised to avoid misjudging interfering pixels; when the dynamic interference intensity is low, the threshold remains unchanged to ensure that small targets are not missed. The response intensity matrix and the locally adaptive threshold matrix are compared pixel-by-pixel. Pixels with response intensities higher than the corresponding threshold are marked as target candidate pixels, and the rest are marked as background pixels, generating a target candidate pixel mask. Connectivity analysis is performed on the target candidate pixel mask. Target candidate pixels with spatial distances less than a set threshold (e.g., 3 pixels) are grouped into the same connected component. Each connected component corresponds to a potential small target region. The minimum bounding rectangle of each connected component is calculated, and this rectangle is used as the initial small target candidate bounding box. A size adaptation model is constructed based on historical statistical data of small target sizes on the water surface (e.g., 10×10 to 32×32 pixels). A range of small target sizes is set, and the size of the initial small target candidate boxes is verified. If the size of the initial candidate box exceeds the range, the rectangle boundary is adjusted according to the pixel distribution of the connected components to make its size adapt to the range of small target sizes. Finally, a set of small target candidate boxes is generated. The small target candidate boxes in this set accurately cover the potential small target regions in the global feature map, and their sizes are highly adapted to the small target sizes in the dynamic target regions.

[0061] This application addresses the problem that small target candidate boxes in visible light water surface scenes have sparse feature details and are easily affected by residual ripples. Traditional local attention methods simply enhance features without adapting to the characteristics of water surface targets. To solve this problem, this application designs scene-specific convolutional enhancement logic, channel attention allocation mechanism, and feature fusion strategy. By extracting edge textures through multi-scale convolution, dynamically allocating channel weights, and fusing global and local features, it achieves accurate enhancement of local features of small targets. Unlike traditional general local attention methods, this approach is more in line with the feature extraction needs of small targets on water surfaces and provides highly recognizable hierarchical attention features for subsequent occlusion completion and target detection.

[0062] Preferably, the specific implementation process of step 33 is as follows: Obtain the set of small target candidate boxes generated in step 32 and the global feature map generated in step 31. First, according to the position coordinates and size of each small target candidate box, crop the corresponding local feature sub-image from the global feature map. The size of the local feature sub-image is consistent with that of the small target candidate box, and the number of channels is the same as that of the global feature map (e.g., 64-256 channels). Construct a multi-scale convolution enhancement module specifically for water surface scenes. This module contains three sets of parallel convolution kernels, namely small-sized odd-numbered convolution kernels (e.g., 3×3 pixels), medium-sized odd-numbered convolution kernels (e.g., 5×5 pixels), and large-sized odd-numbered convolution kernels (e.g., 7×7 pixels). When initializing the weights of each set of convolution kernels, they are tilted towards the edge and texture direction of the water surface target. The small-sized convolution kernels enhance the texture of small components (such as buoy texture), the medium-sized convolution kernels align with the target contour, and the large-sized convolution kernels suppress local residual ripple interference. Three sets of convolution operations are performed simultaneously on each local feature sub-image. The results of the three convolutions are then concatenated along the channel dimension to generate a multi-scale convolutional enhanced feature. This feature integrates local detail information at different scales, effectively improving the richness of the target feature. A channel attention allocation model adapted to water surface scenes is constructed. This model includes a feature aggregation layer and a weight generation layer. The feature aggregation layer converts each channel of the multi-scale convolutional enhanced feature into a single-value feature through global average pooling, reflecting the feature importance of that channel. The weight generation layer introduces a Sigmoid activation function to perform a non-linear transformation on the single-value feature, generating a channel weight vector. The vector element values ​​are the weights of the corresponding channels (range 0-1). Target-related channels (such as edge and texture channels) have higher weights, while interference-related channels have lower weights. The multi-scale convolutional enhanced feature is multiplied channel by channel weight vector to obtain a channel-weighted feature. This feature highlights the response of target-related channels and weakens the influence of interference channels. A global-local feature fusion module is constructed, which performs pixel-level addition and fusion of channel-weighted features and the global feature map of the corresponding region. During the fusion process, the contribution ratio of the two is adjusted by adaptive weight coefficients. The local feature weight of the core target region is higher (e.g., 0.6-0.7), and the global feature weight of the edge region is higher (e.g., 0.6-0.7). Finally, a hierarchical attention feature map is generated. This feature map not only retains global correlation information, but also enhances local edge texture features, which is suitable for the detection requirements of small targets on the water surface.

[0063] Optionally, step 4 includes: Step 41: Calculate the IoU between small target candidate boxes in the hierarchical attention feature map. Candidate boxes with IoU higher than a preset overlap threshold are marked as overlapping candidate box pairs. Step 42: Extract the non-overlapping region features of overlapping candidate box pairs and input them into the generator of the conditional generative adversarial network; Step 43: The generator generates a texture to complete the overlapping area based on the edge direction and texture pattern of the non-overlapping area features. The discriminator verifies the consistency between the completed texture and the real non-overlapping features. After iterative optimization, a complete target feature map is obtained. The texture of the overlapping area in the complete target feature map is continuous and matches the target shape.

[0064] This application addresses the problem of inaccurate overlap determination caused by the dense candidate bounding boxes of small targets in visible light water surface scenes and the fact that traditional IoU calculation does not consider the differences in the scale and positional correlation of targets on the water surface. It designs scene-specific candidate bounding box preprocessing logic, dynamic overlap threshold generation mechanism and association pairing strategy. By screening effective candidate bounding boxes, accurately matching thresholds and target characteristics, and avoiding repeated pairing, it achieves efficient identification of overlapping candidate bounding box pairs. Unlike traditional general IoU calculation and pairing methods, it is more in line with the dense distribution characteristics of small targets on the water surface and the needs of occlusion detection, and provides accurate processing objects for subsequent occlusion feature completion.

[0065] Preferably, the specific implementation process of step 41 is as follows: obtain the hierarchical attention feature map generated in step 33 and the set of small target candidate boxes generated in step 32. First, the set of small target candidate boxes is filtered for validity, and candidate boxes whose coordinates exceed the boundary of the hierarchical attention feature map or whose size is abnormal (such as length and width being less than the set minimum threshold, such as 5 pixels) are removed, and a set of valid small target candidate boxes is generated. A water surface scene-specific IoU calculation model is constructed. This model includes a coordinate normalization layer and an overlap precision calculation layer. The coordinate normalization layer converts the position coordinates of each effective small target candidate box (top left corner x1, y1 and bottom right corner x2, y2) into normalized coordinates relative to the hierarchical attention feature map, eliminating the influence of feature map resolution differences on the calculation results. The overlap precision calculation layer first calculates the overlap region coordinates of any two effective small target candidate boxes (x_overlap=max(x1_1,x1_2), y_overlap=max(y1_1,y1_2), x_overlap_end=min(x2_1,x2_2), y_overlap_end=min(y2_1,y2_2)). If x_overlap>=x_overlap_... If either `end` or `y_overlap` >= `y_overlap_end`, then the two candidate boxes are determined to have no overlap, and the IoU value is 0. Otherwise, the area of ​​the overlapping region (S_overlap = (x_overlap_end - x_overlap) × (y_overlap_end - y_overlap)) and the area of ​​the merged region of the two candidate boxes (S_union = (x2_1 - x1_1) × (y2_1 - y1_1) + (x2_2 - x1_2) × (y2_2 - y1_2) - S_overlap) are calculated. The IoU value is the ratio of S_overlap to S_union. An IoU matrix is ​​generated, where the rows and columns of the matrix correspond to the candidate box indices in the set of valid small target candidate boxes, and the matrix elements are the IoU values ​​of the corresponding two candidate boxes. A dynamic overlap threshold generation model is constructed. This model sets the threshold based on the size distribution of effective small target candidate boxes. The overlap threshold for small candidate boxes (e.g., 10×10 to 20×20 pixels) is set to a low level (e.g., 0.2-0.3), for medium-sized candidate boxes (e.g., 20×20 to 40×40 pixels) it is set to a medium level (e.g., 0.3-0.4), and for large candidate boxes (e.g., above 40×40 pixels) it is set to a high level (e.g., 0.4-0.5). At the same time, the feature response intensity of the corresponding region of the candidate box in the hierarchical attention feature map is combined. The threshold of candidate boxes with high feature response intensity can be appropriately reduced to avoid missing slightly overlapping real targets.The IoU matrix is ​​traversed, and candidate box pairs with IoU values ​​higher than the corresponding dynamic overlap threshold are marked as potential overlapping candidate box pairs. Then, duplicate pairings are removed through a deduplication mechanism (for example, when candidate box A is paired with B, the pairing of B and A is no longer processed). Finally, an overlapping candidate box pair set is generated, which accurately marks the combination of small target candidate boxes with dense overlap in the hierarchical attention feature map.

[0066] Optionally, step 42 includes: Step 421: Crop the features of the non-overlapping regions in the overlapping candidate box pairs, extract feature parameters such as edge gradient and texture direction, and form a non-overlapping feature vector; Step 422: Input the non-overlapping feature vectors into the generator of the conditional generative adversarial network. The generator gradually restores the feature map resolution through transposed convolutional layers and outputs the initial completed texture of the overlapping region. Step 423: The discriminator receives the initial completed texture and non-overlapping region features, outputs the true / false determination probability, and the generator adjusts the parameters according to the determination probability until the determination probability approaches the preset threshold to obtain the final completed texture.

[0067] This application addresses the problems of inaccurate feature extraction of non-overlapping regions in overlapping candidate bounding boxes in visible light water surface scenes, poor adaptability of traditional generative adversarial networks (GANs) for completing textures to the shape of water surface targets, and discriminators not being optimized for water surface features. It designs scene-specific feature clipping and extraction logic, a generator structure adapted to water surface targets, and a feature consistency discrimination mechanism. By accurately extracting key features from non-overlapping regions, gradually restoring resolution to generate complete textures, and rigorously verifying texture consistency, it achieves high-quality completion of missing textures in overlapping regions. Unlike traditional general occlusion completion methods, this approach better matches the edge texture characteristics and occlusion completion requirements of water surface targets, providing reliable support for the generation of complete target feature maps.

[0068] Preferably, the specific implementation process of step 421 is as follows: Obtain the overlapping candidate box pair generated in step 41 and the hierarchical attention feature map generated in step 33. First, determine the position coordinates (x1_1, y1_1, x2_1, y2_1) and (x1_2, y1_2, x2_2, y2_2) of the two candidate boxes in the overlapping candidate box pair, and calculate the coordinates of the overlapping region (x_overlap=max(x1_1, x1_2), y_overlap=max(y1_1, y2_2), x_overlap_end=min(x2_1, x2_2), y_overlap_end=min(y2_1, y2_2)). Based on the coordinates of the overlapping region and the coordinates of the candidate boxes, crop out the non-overlapping region in each candidate box except for the overlapping region, and obtain two non-overlapping region feature sub-maps. The size of the feature sub-maps is the pixel size of the non-overlapping region, and the number of channels is equal to the hierarchical attention feature map. Figure 1To this end, a water surface target feature parameter extraction model is constructed. This model includes an edge gradient calculation layer and a texture direction analysis layer. The edge gradient calculation layer uses multi-directional gradient operators (horizontal, vertical, 45°, 135°) to calculate the gradient value of each pixel in the feature sub-image of the non-overlapping region. The maximum value is taken as the edge gradient parameter of that pixel, highlighting key features such as ship outlines and buoy edges. The texture direction analysis layer uses a sliding window to statistically analyze the gray-level change direction of pixels in the non-overlapping region, determining the primary and secondary texture directions as texture direction parameters. The edge gradient parameters and texture direction parameters of each non-overlapping region feature sub-image are concatenated along the channel dimension to generate a single-channel feature parameter map. The feature parameter map is then expanded into a one-dimensional vector according to pixel position to obtain the non-overlapping feature vector. This vector completely preserves the key feature information of the non-overlapping region, providing a basis for subsequent texture completion.

[0069] Preferably, in the specific technical implementation of step 422: a conditional generative adversarial network generator adapted to the water surface scene is constructed. This generator includes a feature encoding layer, a feature fusion layer, and a resolution restoration layer, each layer introducing a water surface target feature adaptation mechanism. The feature encoding layer uses multiple sets of convolutional kernels (e.g., 3×3, 5×5) to encode non-overlapping feature vectors. When initializing the weights of the convolutional kernels, they are tilted towards common textures of water surface targets (e.g., ship stripes, buoy spots) to generate high-dimensional encoded features. The feature fusion layer introduces a conditional attention mechanism, using the positional information corresponding to the non-overlapping feature vectors as conditions to dynamically adjust the weight allocation of the encoded features, ensuring that the positional adaptation of the completed texture and the non-overlapping area is achieved. The resolution restoration layer consists of multiple sets of transposed convolutional layers, with the transposed convolutional kernel size gradually decreasing (e.g., 8×8, 4×4, 2×2). Each set of transposed convolutional layers is followed by a batch normalization layer and an activation function to gradually restore the high-dimensional encoded features to a resolution consistent with the overlapping area. At the same time, a texture smoothing factor is used to suppress the generation of pseudo-features in the texture. The non-overlapping feature vectors are input into the generator, and after feature encoding, fusion and resolution restoration, the output is an initial complete texture with the same size as the overlapping area. The edge direction and texture pattern of this texture are highly consistent with the non-overlapping area, which is adapted to the morphological features of the water surface target.

[0070] Preferably, the specific implementation process of step 423 is as follows: A water surface feature consistency discriminator is constructed. This discriminator includes a local feature extraction layer and a global consistency verification layer. The local feature extraction layer uses depthwise separable convolution to extract local detail features (such as edge gradients and texture density) of the initial completed texture and non-overlapping region features, avoiding redundant calculations. The global consistency verification layer calculates the global statistical features (such as mean, variance, and texture direction distribution) of the two types of features and determines their consistency through similarity calculation. The initial completed texture and non-overlapping region features are input into the discriminator. The local feature extraction layer outputs local feature maps of the two types of features, and the global consistency verification layer outputs the probability of true / false determination. A probability value close to 1 indicates high consistency between the initial completed texture and non-overlapping region features, while a probability value close to 0 indicates low consistency. Set a threshold for the determination probability (e.g., 0.8-0.9). If the probability of determining true or false is lower than the threshold, the generator adjusts the parameters of each layer according to the gradient feedback of the discriminator, focusing on optimizing the texture regions with large differences in features from the non-overlapping regions. Repeat the generation and discrimination process until the probability of determining true or false approaches the threshold. The output of the completed texture at this time is the final completed texture. This texture is continuous and consistent with the features of the non-overlapping regions in terms of edges and texture, and can accurately fill in the feature loss of the overlapping regions.

[0071] This application addresses the issues of poor consistency between the completed texture and the original texture of the target in overlapping areas in visible light water surface scenes, the inability of traditional generative adversarial networks to adapt to the morphological characteristics of water surface targets, and the lack of scene-specific iterative optimization. It designs a scene-specific texture generation guidance mechanism, a multi-dimensional consistency discrimination model, and a dynamic iterative optimization strategy. By accurately capturing the feature patterns of non-overlapping areas to generate completed textures, verifying texture consistency in multiple dimensions, and dynamically adjusting the optimization direction, it achieves high-quality completion of textures in overlapping areas. Unlike traditional general occlusion completion methods, it is more in line with the edge direction and texture distribution characteristics of water surface targets (ships, buoys, etc.), ensuring the texture continuity and morphological adaptability of the complete target feature map.

[0072] Preferably, the specific implementation process of step 43 is as follows: Obtain the initial versions of the non-overlapping feature vectors and the final completed texture generated in step 42. First, construct a water surface target edge texture guidance model, which includes an edge direction prediction layer and a texture pattern adaptation layer. The edge direction prediction layer performs polynomial fitting on the feature map of the non-overlapping region corresponding to the non-overlapping feature vectors, extracts the coordinate sequence of edge pixels, predicts the extension direction of the edge in the overlapping region (such as the linear extension of the straight edge of a ship and the curved extension of the arc-shaped edge of a buoy), and generates an edge guidance path. The texture pattern adaptation layer statistically analyzes the texture density, grayscale period, and brightness contrast of the non-overlapping region, and combines this with the texture characteristics of common targets in water surface scenes (such as the spacing of stripes on a ship's deck and the distribution density of spots on the surface of a buoy) to generate texture generation constraint rules. The generator iteratively optimizes the initial completed texture based on the edge guidance path and the texture generation constraint rules. First, it adjusts the coordinates of the edge pixels in the overlapping region to seamlessly connect with the edges of the non-overlapping region, and then fills the pixels inside the overlapping region according to the texture pattern constraints to generate an intermediate completed texture. A multi-dimensional consistency discrimination model is constructed, comprising a local feature matching layer, a global shape verification layer, and a scene characteristic adaptation layer. The local feature matching layer calculates the similarity of local features such as edge gradients and texture directions between the intermediate completed texture and the feature maps of non-overlapping areas. The global shape verification layer compares the fit between the overall shape of the completed target and the typical shape of water surface targets (such as the elongated shape of a ship or the circular shape of a buoy). The scene characteristic adaptation layer verifies whether the grayscale distribution of the completed texture conforms to the light reflection rules of the water surface scene (such as the grayscale range of reflective areas under strong light). The discriminator outputs a comprehensive consistency score through this model. When the score is lower than a set threshold (e.g., 0.85), the generator focuses on optimizing areas with large consistency deviations (such as areas with uneven edge connections or mismatched texture densities) based on the gradient information fed back by the discriminator. The texture generation and consistency discrimination process is repeated, and the weight of the edge guiding path and the strictness of the texture constraint rules are dynamically adjusted in each iteration until the comprehensive consistency score approaches the threshold. At this point, the generated completed texture and the features of the non-overlapping areas are highly consistent in terms of edges, texture, and shape. The optimized completed texture is stitched together with the feature map of the non-overlapping area according to pixel position. A smooth transition processing is performed on the stitching area (using a weighted average method, with a linear transition of weights within a preset range (e.g., 3-5 pixels) on both sides of the stitching boundary) to eliminate stitching traces and generate a complete target feature map. In this feature map, the texture of the overlapping area is continuously connected with the non-overlapping area and matches the actual shape of the target such as the ship and buoy, with no obvious false features.

[0073] Optionally, step 5 includes: Step 51: Construct a dynamic anchor frame generator. Based on historical water surface target size statistics, generate multiple sets of anchor frame sizes and aspect ratios that are adapted to ships, buoys, and floating objects through density clustering, forming a scene-adaptive anchor frame set. Step 52: Perform IoU matching between the complete target feature map and the scene-adapted anchor box set, and filter out positive sample anchor boxes; Step 53: Perform category determination on the positive sample anchor boxes through the classification branch, and fine-tune the position and size of the positive sample anchor boxes through the regression branch. Output the target category, bounding box and confidence score to obtain the visible light water surface target detection results.

[0074] Optionally, step 51 includes: Step 511: Collect historical surface target detection data, count the length and width pixel values ​​of ships, buoys, and floating objects, and generate a target size distribution table; Step 522: Perform density clustering on the data in the target size distribution table to obtain several sets of core sizes; Step 513: Based on the physical form of different target types, assign an appropriate aspect ratio to each core size group to form a scene adaptation anchor frame set. The proportion of small-sized anchor frames in the scene adaptation anchor frame set shall not be less than the set ratio threshold.

[0075] This application addresses the issues of poor compatibility between traditional fixed anchor frames and target sizes, and large matching deviations for small targets in visible light water surface scenes. It designs scene-specific historical data collection and filtering logic, a density clustering method adapted to the distribution of water surface targets, and a typified aspect ratio allocation strategy. By accurately statistically analyzing target sizes, extracting core size clusters, and matching the physical shape of targets to allocate aspect ratios, it generates scene-specific anchor frame sets adapted to ships, buoys, and floating objects. Unlike traditional general anchor frame generation methods, this approach better reflects the scale distribution characteristics and physical shape differences of water surface targets, improving the anchor frame matching accuracy between small targets and various types of water surface targets.

[0076] Preferably, the specific implementation process of step 511 is as follows: Collect historical water surface target detection data covering different water surface scenes (ocean, lake, inland river), different lighting conditions (strong light, cloudy, foggy), and different target distances (near, medium, far). The dataset contains the true bounding boxes of three types of targets: labeled ships, buoys, and floating objects. Perform validity screening on the historical data, removing samples with incorrect labeling, incomplete bounding boxes, or severely occluded targets (occlusion area exceeding 50%), retaining the valid sample set. Iterate through each sample in the valid sample set, extracting the vertical pixel length (H) and horizontal pixel width (W) of each target's true bounding box, recording the target category label (ship, buoy, floating object) and corresponding scene information (such as lighting conditions and target distance). Classify and statistically analyze by target category, generating original size data tables for each of the three target types. Then integrate the three data tables to form a target size distribution table containing target category, length H, width W, and scene information. This table fully reflects the size distribution patterns of different types of water surface targets in diverse scenes.

[0077] Preferably, in the specific technical implementation of step 512 (Note: the original number "Step 522" is uniformly corrected to "Step 512" to ensure logical coherence): a density clustering model adapted to the size distribution of water surface targets is constructed. This model includes a data normalization layer, a distance metric layer, and a clustering termination decision layer. The data normalization layer converts the length H and width W in the target size distribution table into relative sizes (the ratio relative to the image resolution; for example, when the image resolution is 1920×1080, H and W are divided by 1080 and 1920 respectively), eliminating the influence of image resolution differences on the clustering results. The distance metric layer uses weighted Euclidean distance to calculate the similarity between two target size samples, giving higher weight to the size difference of small targets (length or width less than 32 pixels), thus strengthening the clustering discriminative power of small targets. The clustering termination decision layer sets a range for the number of clusters (e.g., 3-8 groups) and a threshold for intra-cluster variance (e.g., 0.01). When the number of clusters reaches the set range and the intra-cluster variance is lower than the threshold, clustering stops. The standardized target size data is input into the density clustering model, and several clusters are obtained through iterative calculation. Each cluster corresponds to a group of target clusters with similar sizes. The center size of each cluster (the mean of the sizes of all samples in the cluster) is extracted as the core size to generate a core size set. The core size set covers three scales: small, medium and large, and the proportion of small core sizes matches the proportion of small targets in historical data (e.g., about 85%).

[0078] Preferably, the specific implementation process of step 513 is as follows: Based on the physical characteristics of the three types of targets—ships, buoys, and floating objects—a categorized aspect ratio allocation rule is constructed. Ships are mostly elongated, so multiple narrow aspect ratios (e.g., 1:3, 1:4, 1:5) are assigned to them; buoys are mostly circular or nearly circular, so an aspect ratio of approximately 1:1 is assigned (e.g., 1:1, 1:1.2, 1.2:1); and floating objects are irregularly shaped, so multiple general aspect ratios (e.g., 1:2, 2:1, 1:1.5) are assigned to them. For each core size group in the core size set, an appropriate aspect ratio is assigned based on its corresponding target category distribution (determined by the proportion of target categories in the cluster). For example, small core sizes (such as 10×10 pixels, 15×15 pixels) correspond to small targets (mostly distant buoys or floating objects), and are preferentially assigned an aspect ratio of 1:1 or 1:1.2; medium core sizes (such as 32×32 pixels, 48×48 pixels) correspond to medium-distance ships or buoys, and are assigned an aspect ratio of 1:3 or 1:1; large core sizes (such as 96×96 pixels, 128×128 pixels) correspond to close-range ships, and are assigned an aspect ratio of 1:4 or 1:5. Each core size is combined with the assigned aspect ratio to generate multiple sets of anchor frame parameters (length, width), forming a scene-adaptive anchor frame set. The proportion of small-sized anchor frames (the length or width corresponding to the core size is less than 32 pixels) is set to be no less than a set ratio threshold (e.g., 60%) to ensure the anchor frame set covers small targets and improves the matching probability of small targets.

[0079] This application addresses the issues of weak feature response of small targets in visible light water surface scenes and the tendency of traditional IoU matching to result in missed anchor boxes for small targets or mismatches with the background. It designs a scene-specific anchor box-feature adaptation preprocessing, dynamic matching threshold generation, and multi-dimensional positive sample screening mechanism. By enhancing the feature response of small targets, accurately matching anchor boxes with target features, and eliminating invalid matches, it achieves efficient screening of positive sample anchor boxes. Unlike traditional general IoU matching methods, it is more in line with the feature distribution characteristics and scale differences of small targets on the water surface, improves the matching accuracy of anchor boxes and targets, and provides high-quality sample support for subsequent classification and regression.

[0080] Preferably, the specific implementation process of step 52 is as follows: Obtain the complete target feature map generated in step 43 and the scene-fitting anchor box set generated in step 51. First, perform feature enhancement preprocessing on the complete target feature map to construct a small target feature enhancement module for the water surface. This module compresses the channel dimension and enhances the feature response intensity through a 1×1 convolution kernel. Then, a local contrast enhancement algorithm is used to enhance the feature contrast of small target regions (e.g., 10×10 to 32×32 pixels), generating an enhanced complete target feature map to ensure that small target features are not submerged during the matching process. Traverse each anchor box in the scene-fitting anchor box set. Based on the size and position coordinates of the anchor box, crop the corresponding anchor box feature sub-image from the enhanced complete target feature map. The size of the anchor box feature sub-image is consistent with the anchor box, and the number of channels is the same as the enhanced complete target feature map. A dynamic IoU matching model adapted to water surface scenarios is constructed. This model includes an anchor frame type adaptation layer and a threshold dynamic adjustment layer. The anchor frame type adaptation layer adjusts the weight allocation of IoU calculation according to the anchor frame size type (small, medium, large), assigning higher weights to the overlapping area of ​​small-sized anchor frames (e.g., 10×10, 15×15 pixels) to weaken the influence of boundary deviation. The threshold dynamic adjustment layer combines the feature response intensity of the corresponding region in the enhanced complete target feature map. When the feature response intensity is high (high target probability), the matching threshold is set to a lower level (e.g., 0.2-0.3), and when the feature response intensity is low, it is set to a higher level (e.g., 0.3-0.4), generating a dynamic matching threshold corresponding to each anchor frame. The IoU value between each anchor frame feature sub-map and the corresponding region in the enhanced complete target feature map is calculated, and anchor frames with IoU values ​​higher than the corresponding dynamic matching threshold are marked as preliminary positive sample anchor frames. A multi-dimensional positive sample verification model is constructed, which verifies the anchor frame from three dimensions: feature similarity, location rationality, and scale adaptability. For feature similarity, the cosine similarity between the anchor frame feature sub-image and the corresponding region features is calculated, and anchor frames with similarity higher than a set threshold (e.g., 0.6) are selected. For location rationality, it is verified whether the center of the anchor frame falls within the dynamic target region of the enhanced complete target feature map, and anchor frames falling into the background region are removed. For scale adaptability, the anchor frame size is compared with the estimated size of the target in the corresponding region (estimated through feature response range), and anchor frames with size differences within a preset proportion (e.g., 30%) are selected. The verification results from the three dimensions are integrated, and only preliminary positive sample anchor frames that meet all verification conditions are retained, ultimately generating a set of positive sample anchor frames. This set accurately covers the water surface target region, and the matching success rate of small target anchor frames is significantly improved.

[0081] This application addresses the issues of low classification confidence and large bounding box localization deviation for small targets in visible light water surface scenes, as well as the incompatibility of traditional classification and regression branches with the characteristics of water surface targets. It designs scene-specific classification feature enhancement logic, a small target-friendly regression loss function, and a confidence calibration mechanism. By strengthening category distinguishing features, optimizing bounding box fine-tuning accuracy, and dynamically calibrating confidence, it achieves accurate output of water surface target categories and bounding boxes. Unlike traditional general classification and regression methods, it better fits the feature distribution and scale differences of water surface targets, improving the detection accuracy of small targets and densely occluded targets.

[0082] Preferably, the specific implementation process of step 53 is as follows: Obtain the positive sample anchor frames selected in step 52 and the complete target feature map generated in step 43. First, for each positive sample anchor frame, the corresponding anchor frame feature sub-image is cropped from the complete target feature map. The anchor frame feature sub-image is compressed into a one-dimensional feature vector through 1×1 convolution. This vector contains the target's category-related features and location-related features. Construct a classification branch adapted for water surface target classification. This branch includes a feature enhancement layer and a category determination layer. The feature enhancement layer introduces a water surface target category differentiation module to enhance the specific features of three types of targets: ships, buoys, and floating objects (such as the elongated outline features of ships, the circular texture features of buoys, and the irregular edge features of floating objects). The response intensity of the category differentiation features is improved through a channel attention mechanism. The category determination layer uses the Softmax activation function to calculate the probability value of the one-dimensional feature vector belonging to the three types of targets and the background. The category with the highest probability value is taken as the initial target category, and the corresponding probability value is taken as the initial confidence level. A small-target-friendly regression branch is constructed, employing a designed bounding box fine-tuning model. This model uses the true position offset of the target in the complete target feature map as supervision, outputting four adjustment parameters (Δx1, Δy1, Δx2, Δy2) of the bounding box through a fully connected layer. These parameters correspond to the pixel offsets of the top-left (x1, y1) and bottom-right (x2, y2) corners of the positive sample anchor boxes, respectively. The regression loss uses a variant of the CIoU loss adapted for small targets, assigning higher weights to the positional deviations of small-sized anchor boxes (e.g., 10×10 to 32×32 pixels) to improve the fine-tuning accuracy of small target bounding boxes. The initial confidence corresponding to the preliminary target category is combined with the bounding box fine-tuning results to construct a dynamic confidence calibration model. This model calibrates the initial confidence based on the bounding box adjustment magnitude (the sum of the absolute values ​​of the adjustment parameters) and the target feature response intensity. Smaller adjustment magnitudes and higher feature response intensity result in higher calibrated confidence; conversely, larger adjustment magnitudes lead to appropriately lower confidence, avoiding false detections caused by large bounding box adjustments. Set a screening threshold (e.g., 0.5) for the calibrated confidence level, retain detection results with confidence levels higher than the threshold, and finally output the visible light water surface target detection results that include the target category (ship, buoy, floating object), the fine-tuned bounding box coordinates (x1, y1, x2, y2) and the calibrated confidence level. This result accurately reflects the actual category and location of the water surface target.

[0083] like Figure 2 The image shown is an embodiment of a visible light water surface target detection device based on sea level constraints and hierarchical generative attention, comprising: a scene preprocessing module for acquiring a visible light water surface scene image, performing scene semantic segmentation to locate the sea level curve, dividing the water surface candidate area into a non-water surface exclusion area, filtering the non-water surface exclusion area to obtain a water surface focused image; performing adaptive Gaussian filtering on the water surface focused image to suppress static ripple interference, extracting dynamic regions through inter-frame difference and generating a dynamic target mask, and separating the dynamic target region from the water surface focused image using the dynamic target mask; and a hierarchical attention feature extraction module for constructing a hierarchical generative attention architecture, through global... The attention layer performs global correlation calculations on dynamic target regions, filters out small target candidate boxes, and then enhances the edge texture features of the corresponding regions of the small target candidate boxes through the local attention layer to generate a hierarchical attention feature map; the occlusion feature completion module is used to fill in the missing texture of the overlapping region based on the features of the non-overlapping region for the overlapping candidate boxes in the hierarchical attention feature map that exceed the IoU threshold, and generate a complete target feature map; the target detection output module is used to match the complete target feature map with the adapted anchor boxes generated by the dynamic anchor box generator, and outputs the target category, bounding box and confidence score through classification branch and regression branch to obtain the visible light water surface target detection result.

[0084] This embodiment also provides a computer-readable storage medium storing at least one instruction or at least one program, which is loaded and executed by a processor to implement the above-described visible light surface target detection method based on sea level constraints and hierarchical generative attention.

[0085] like Figure 3 As shown, an electronic device according to an embodiment of this application is provided. The electronic device includes a processor and a memory. The memory stores at least one instruction or at least one program. The at least one instruction or the at least one program is loaded and executed by the processor to implement the above-described visible light water surface target detection method based on sea level constraints and hierarchical generative attention.

[0086] This application also includes a computer program product or computer program, which includes computer instructions that, when executed by a processor, implement the above-described visible light surface target detection method based on sea level constraints and hierarchical generative attention.

[0087] For specific examples of the aforementioned devices and products, please refer to the above. Figure 1 The records.

Claims

1. A visible light water surface target detection method based on sea level constraint and hierarchical generative attention, characterized in that, The method comprises the following steps: Step 1, obtaining a visible light water surface scene image, performing scene semantic segmentation on the image to locate the sea level curve to generate a water surface focusing image; Step 2, performing adaptive Gaussian filtering on the water surface focusing image to generate a dynamic target mask, and separating a dynamic target region from the water surface focusing image in combination with the dynamic target mask; Step 3, performing global correlation calculation on the dynamic target region, screening out small target candidate boxes, and then strengthening edge texture features in regions corresponding to the small target candidate boxes to generate a hierarchical attention feature map; Step 4, for overlapping candidate boxes with an IoU (Intersection over Union) value exceeding a threshold in the hierarchical attention feature map, completing missing textures in overlapping regions according to features in non-overlapping regions to generate a complete target feature map; and Step 5, matching the complete target feature map with an adaptive anchor box generated by a dynamic anchor box generator to obtain a visible light water surface target detection result.

2. The visible water surface target detection method based on sea level constraint and hierarchical generative attention according to claim 1, characterized in that, Step 1 comprises the following steps:

3. The visible water surface object detection method based on sea level constraint and hierarchical generative attention according to claim 2, characterized in that, Step 11, inputting the visible light water surface scene image into a lightweight semantic segmentation network to output three types of semantic label images of water surface, sky and shoreline; Step 12, performing Hough transform fitting on the water-sky and water-shoreline boundaries in the semantic label image to obtain the sea level curve; and Step 13, taking the sea level curve as a boundary, marking the region below the curve as a water surface candidate region, marking the region above the curve and the shoreline region as a non-water surface exclusion region, and generating a water surface focusing image after cropping the non-water surface exclusion region, wherein the water surface focusing image only retains pixel information of the water surface candidate region.

4. The visible water surface object detection method based on sea level constraint and hierarchical generative attention according to claim 2, characterized in that, Step 11 comprises the following steps:

5. The visible water surface object detection method based on sea level constraint and hierarchical generative attention according to claim 1, characterized in that, Step 111, performing pixel-level gray scale statistics on the visible light water surface scene image to generate a gray scale distribution histogram; Step 112, determining an initial segmentation threshold of the semantic segmentation network based on the gray scale distribution histogram and inputting the feature extraction layer of the lightweight semantic segmentation network; and Step 113, outputting multi-scale semantic features through the feature extraction layer, processing the multi-scale semantic features through upsampling and a pixel classification layer, and generating three types of semantic label images of water surface, sky and shoreline, wherein each pixel in the semantic label image corresponds to one type of scene label. Step 12 comprises the following steps: Step 121, traversing the semantic label image, extracting pixel coordinates of the water-sky and water-shoreline boundaries to form a boundary pixel set; Step 122, performing Hough transform on the boundary pixel set to obtain a plurality of candidate straight lines; and Step 123, calculating the coincidence degree of the candidate straight lines with the water surface region in the semantic label image, and screening out the candidate straight line with the highest coincidence degree as the sea level curve, wherein the pixel coordinates of the sea level curve cover the core region of the boundary pixel set. Step 2 comprises the following steps: Step 21, calculating the gray scale variance of each pixel block in the water surface focusing image, dynamically adjusting the size of the Gaussian filter kernel according to the gray scale variance, using a small-size filter kernel for a region with high gray scale variance and using a large-size filter kernel for a region with low gray scale variance, and generating a ripple suppression image after performing filtering; Step 22, obtaining a previous frame image of the water surface focusing image, calculating the gray scale difference of corresponding pixels of the two images, setting an adaptive threshold to screen pixels with a gray scale difference exceeding the threshold, and generating a dynamic region mask; and Step 23, performing pixel-level AND operation on the dynamic region mask and the ripple suppression image to separate out a dynamic target region, wherein the dynamic target region only retains pixels satisfying both ripple suppression and dynamic characteristics.

6. The visible water surface target detection method based on sea level constraint and hierarchical generative attention according to claim 5, characterized in that, Step 21 comprises: step 211, dividing the water surface focus image into a plurality of pixel blocks according to a preset size, and calculating the gray variance of each pixel block; step 212, setting a gray variance threshold interval, when the gray variance of a pixel block is higher than the upper limit of the interval, setting the filter kernel size as a first preset value, when the gray variance is lower than the lower limit of the interval, setting the filter kernel size as a second preset value, and when the gray variance is within the interval, setting the filter kernel size as a third preset value; step 213, performing Gaussian filtering on each pixel block with a corresponding size, and splicing the filtered pixel blocks to generate a ripple suppression image, wherein the gray scale fluctuation amplitude of the static ripple in the ripple suppression image is reduced.

7. The visible water surface object detection method based on sea level constraint and hierarchical generative attention according to claim 1, characterized in that, Step 3 comprises: step 31, constructing a global attention layer, performing global correlation weight calculation on the pixel features of the dynamic target region, strengthening the target region pixel response, weakening the background region pixel response, and outputting a global feature map; step 32, setting a candidate box generation threshold based on the pixel response intensity of the global feature map, and screening the regions with response intensity exceeding the threshold as small target candidate boxes, wherein the size of the small target candidate boxes is adapted to the size of the small target in the dynamic target region; step 33, constructing a local attention layer, performing convolution and channel attention calculation on the region corresponding to the small target candidate box, strengthening the target edge and texture features, and generating a hierarchical attention feature map, wherein the hierarchical attention feature map fuses global correlation information and local detail features.

8. The visible water surface target detection method based on sea level constraint and hierarchical generative attention according to claim 7, characterized in that, Step 31 comprises: step 311, converting the feature map of the dynamic target region into a feature vector, calculating the cosine similarity of any two feature vectors, and obtaining a global correlation matrix; step 312, performing row normalization on the global correlation matrix to obtain a global attention weight matrix; step 313, performing pixel-by-pixel weighting on the global attention weight matrix and the feature map of the dynamic target region to generate a global feature map, wherein the feature response value of the target region in the global feature map is higher than that of the background region.

9. The visible water surface object detection method based on sea level constraint and hierarchical generative attention according to claim 1, characterized in that, Step 4 comprises: step 41, calculating the IoU between the small target candidate boxes in the hierarchical attention feature map, and marking the candidate boxes with IoU higher than a preset overlap threshold as overlapping candidate box pairs; step 42, extracting the non-overlapping region features of the overlapping candidate box pairs and inputting them into the generator of the conditional generative adversarial network; step 43, the generator generates complete texture for the overlapping region according to the edge direction and texture rules of the non-overlapping region features, the discriminator verifies the consistency of the complete texture and the real non-overlapping features, and the complete target feature map is obtained after iterative optimization, wherein the texture of the overlapping region in the complete target feature map is continuous and matches the target shape.

10. The visible water surface target detection method based on sea level constraint and hierarchical generative attention according to claim 9, characterized in that, Step 42 comprises: step 421, cropping the features of the non-overlapping region in the overlapping candidate box pair, extracting feature parameters such as edge gradient and texture direction, and composing a non-overlapping feature vector; step 422, inputting the non-overlapping feature vector into the generator of the conditional generative adversarial network, and the generator gradually restores the feature map resolution through the transpose convolution layer to output the initial complete texture of the overlapping region; step 423, the discriminator receives the initial complete texture and the non-overlapping region features, outputs a true-false judgment probability, and the generator adjusts the parameters according to the judgment probability until the judgment probability approaches a preset threshold to obtain the final complete texture.

Citation Information

Patent Citations

  • Sea surface target detection method based on improved RBD significance calculation

    CN108764027A

  • Sea surface target detection method based on scene priori knowledge

    CN112417961A

  • Ship detection method and device based on prolate anchor point and line segment expansion technology

    CN115082694A

  • Sea-land-air tiny target detection method based on focus attention network enhancement

    CN118379480A

  • Room obstacle target detection method and system based on multi-modal information

    CN119048747A