Accurate segmentation and fusion detection method and system for biological attachment of ocean structure
By using an improved U-Net/Mask R-CNN architecture and multi-scale feature fusion technology, the problems of low efficiency and poor adaptability in detecting biological attachments on marine structures are solved. This achieves accurate segmentation and fusion detection, outputs fine quantitative indicators, and is adaptable to multiple environments and equipment conditions.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHEJIANG UNIV
- Filing Date
- 2025-12-25
- Publication Date
- 2026-04-21
AI Technical Summary
Existing manual methods for detecting biofouling on marine structures are inefficient, risky, and subjective. General-purpose deep learning models are poorly adapted to the marine environment and cannot output precise quantitative indicators.
An improved U-Net/Mask R-CNN architecture is adopted, which combines multi-scale feature fusion, hierarchical attention and morphological adaptation modules. Through preprocessing and conditional random fields, the accurate segmentation and fusion detection of biological attachments on marine structures is achieved.
It improves the targeting and generalization ability of marine organism attachment segmentation, can work stably in multiple environments, outputs fine quantitative indicators, adapts to the significant morphological differences between hard-shelled and soft-bodied organisms, and supports multi-platform deployment.
Smart Images

Figure CN121904569A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the interdisciplinary field of artificial intelligence and marine engineering technology, and relates to a method and system for accurate segmentation and fusion detection of biological attachments on marine structures. Specifically, it relates to a method and system for the automated identification, segmentation and quantitative analysis of biological attachments on the surface of structures in a marine environment by applying computer vision deep learning technology. Background Technology
[0002] Biofouling is widespread on the surfaces of marine structures (bridge piers, ship hulls, offshore wind turbine foundations, port terminals, etc.). This biofouling increases hydrodynamic resistance, causes corrosion and fatigue problems, raises maintenance costs, and threatens structural safety. Current manual inspection methods are inefficient, risky, and highly subjective.
[0003] Currently, manual identification remains the mainstream method in the field of marine organism attachment detection. However, this method has significant shortcomings in many aspects, including detection efficiency, labor cost control, and result stability and consistency. It not only relies on the experience and judgment of professionals, making it highly subjective and susceptible to environmental factors (such as underwater high pressure, strong reflections in splash zones, and complex intertidal terrain), leading to inconsistent detection accuracy, but also suffers from high operational risks, limited coverage, and inability to meet the needs of large-scale routine inspections. Deep learning, as a core technology that has rapidly emerged and continued to develop in the field of computer vision in recent years, demonstrates outstanding advantages in tasks such as target recognition and semantic segmentation due to its powerful feature extraction and complex scene adaptation capabilities. Applying it to the field of marine organism attachment detection is expected to overcome the limitations of traditional manual detection and has broad prospects for technological implementation and industrial promotion. However, when general object detection or semantic segmentation models are directly transferred to this specific task, they will exhibit significant shortcomings due to insufficient scene adaptability: only the bounding box is output and the true area cannot be known; general segmentation models are poorly adapted to densely overlapping clusters, scale / morphological heterogeneity, color bias / turbidity / backscattering, motion blur and strongly reflective scenes, often resulting in blurred boundaries, missed detection of small targets and oversegmentation / undersegmentation.
[0004] Therefore, there is an urgent need for a segmentation method and system specifically designed for the physical and imaging characteristics of marine organism attachments, which can work stably under various environmental and equipment imaging conditions such as underwater, intertidal zone, and splash zone, and output fine quantitative indicators that can be used for engineering decision-making. Summary of the Invention
[0005] The purpose of this invention is to address the shortcomings of existing technologies by providing a method and system for precise segmentation and fusion detection of bio-attachment on marine structures. This method and system improve the targeting and generalization ability of marine bio-attachment segmentation and enhance the ability to distinguish the boundaries of densely overlapping individuals. It can effectively adapt to hard-shelled and soft-bodied organisms with significant morphological differences. This invention provides an integrated engineering solution for bio-attachment on the surface of marine structures, from collection to quantitative evaluation.
[0006] The technical solution adopted in this invention is as follows: A method for precise segmentation and fusion detection of bioattachment on marine structures, comprising: The collected images of marine structures are preprocessed and then input into a trained core deep learning model for further processing. The model outputs accurate segmentation results for different types of biological attachments and monitoring results for key areas. The core deep learning model adopts an improved U-Net / Mask R-CNN architecture, integrating multi-scale feature fusion, hierarchical attention, and morphological adaptation modules. After optimization training using a combined loss function, it achieves accurate segmentation of different types of biological attachments. The boundaries are then refined using a Conditional Random Field (CRF) and a watershed algorithm. The preprocessed images are pre-identified using OpenCV and precisely labeled with LabelMe to construct a dedicated dataset, which is divided into training, validation, and test sets. Metadata on biological coverage is added for model training.
[0007] In the above technical solution, the acquired images of marine structures are further preprocessed, which includes four core processing steps: color correction, dehazing / de-backscattering, noise reduction, and distortion correction.
[0008] Furthermore, the preprocessing specifically includes: (1) Color correction: By adjusting the gain of each channel, the average values of the three channels are balanced, thereby eliminating color cast. Specifically, the following steps are taken: convert the RGB image data collected underwater into floating point type, and then calculate the pixel average value of each of the three channels. The global grayscale average value is calculated based on the average value of the three channels as the benchmark for color balance. The gain coefficient of each channel is calculated according to the difference between the global grayscale average value and the average value of each channel. The gain coefficient of each channel is multiplied by the pixel matrix of the corresponding channel to obtain the corrected single-channel image. (2) Eliminate marine environmental scattering interference: The backscattered light of the underwater image is regarded as the superposition of "atmospheric light + scattering coefficient × transmission rate". The transmission rate is estimated through the dark channel to separate the backscattered light from the target reflected light. Specifically, the dark channel of the image is calculated first to form a dark channel image. The 0.2% of pixels with the highest brightness in the dark channel image are selected. The average brightness of these pixels in the original image is taken as the atmospheric light value A. The transmission rate is calculated based on the dark channel and the atmospheric light value to reflect the proportion of target light reaching the camera. Finally, the target image is restored to eliminate backscattering interference. (3) Suppress marine environmental noise interference: adopt a combination strategy of coarse noise reduction followed by fine noise reduction, specifically including: first use bilateral filtering for noise reduction, and then use adaptive median filtering for motion noise caused by water flow disturbance and equipment vibration. (4) Distortion correction: The scheme of camera calibration and distortion parameter correction is adopted, which includes: before acquiring the image, the acquisition device is calibrated using a checkerboard calibration board to obtain the camera's inherent parameters and distortion parameters, and the pixel values of the corrected image are filled using a bilinear interpolation algorithm.
[0009] Furthermore, the method for constructing the dedicated dataset includes the following: Images of concrete marine structures with attached marine organisms in nearshore areas were collected, and images were standardized in size. Organisms in the images were identified and labeled. In addition to labeling specific organism categories, labels were also created targeting biological communities, which were further classified based on equivalent cover density and dominant organisms. The main methods are as follows: 1) OpenCV Preliminary Recognition: After preprocessing, the RGB images are converted to grayscale images. Preliminary differentiation of attachment types is achieved through joint screening using gradient thresholding and contour thresholding. The Canny edge detection algorithm is used to extract image gradient information, highlighting the edge features of biological attachments. Based on the characteristics of hard-shelled organisms with steep edges and high gradient values, and soft-bodied organisms with gentle edges and low gradient values, gradient threshold ranges are set. High gradient thresholds greater than 100 correspond to hard-shelled organism candidate regions, and low gradient thresholds of 50-100 correspond to soft-bodied organism candidate regions. Adaptive thresholding is then performed on the gradient-classified images to generate binary images. The image is analyzed, and the contours are extracted using the cv2.findContours function. An area threshold is set to filter out noise points and excessively large interference areas. Combining the gradient interval and contour morphology, the preliminary classification results of hard-shelled and soft-bodied organism attachments and corresponding candidate regions are output. For regions where various organisms grow in a mixed manner and classification is difficult, the overall contour, area, and dominant organism species of the region are output. Pixels of the exposed and organism-attached parts of concrete marine structures are extracted, and the equivalent biological coverage is calculated. The analyzed data is combined with the original image to improve the model processing efficiency and subsequent semantic segmentation accuracy. 2) Labeling and Image Segmentation: Based on the OpenCV recognition results, a usable dataset for deep learning is constructed through the following steps: First, label enhancement: using the contours extracted by OpenCV as a basis, the LabelMe tool is used to accurately label four types of regions, including hard shells, soft bodies, complex communities, and interfering backgrounds, supplementing the background labels of exposed marine structures to form a semantic segmentation label map; Second, data association: using the calculated biological coverage, dominant species, and other attributes as label metadata, and binding them with the corresponding images and label maps; Third, data augmentation: performing enhancement operations such as flipping, scaling, and brightness perturbation on the labeled data to expand the dataset size; Fourth, format conversion: converting the labeled files into a mask format compatible with the deep learning framework, and dividing the training set, validation set, and test set in a 7:2:1 ratio to ensure the accuracy and balanced distribution of the dataset labels and improve the model training effect.
[0010] Furthermore, the core deep learning model adopts an improved U-Net, which includes two parts: an encoder and a decoder. The encoder uses a stacked structure of convolutional layers, batch normalization, and ReLU activation function, combined with max pooling to achieve feature downsampling and gradually extract high-level semantic features of the image. The decoder achieves feature upsampling through transposed convolution and simultaneously performs skip connections with the feature maps of the corresponding layers of the encoder to supplement low-level detailed features. An ASPP module is added between the encoder and the decoder to expand the receptive field without reducing the resolution and capture biological attachment features at different scales.
[0011] Furthermore, the multi-scale feature fusion achieves collaborative extraction of macroscopic and microscopic features through a parallel dual-branch structure. The specific design is as follows: The first branch is the macroscopic feature branch, which adopts a combination of dilated convolution and pyramid pooling to extract the community outline and spatial distribution features of biological attachments. The dilation rate of the dilated convolution is 2, 4, or 6, and the scale of the pyramid pooling is 1×1, 2×2, 4×4, or 8×8. The second branch is the microscopic feature branch, which adopts a 3×3 small convolution kernel and a high-resolution feature preservation strategy. By reducing pooling operations and increasing the number of convolution layers, it captures the edge and texture details of biological individuals. After feature alignment, the feature maps output by the two branches are spliced and fused in the channel dimension. After fusion, 1×1 convolution is used to reduce parameter redundancy, and finally, a multi-scale fused feature with both global vision and detail accuracy is obtained. Multi-scale fusion features are mapped to a prediction probability map with the same size as the input image through the final convolutional layer. The probability map is converted into pixel-level class prediction results through the argmax function to obtain the initial segmentation mask. Post-processing operations are performed on the initial segmentation mask: Conditional Random Field (CRF) is used to optimize the smoothness of the segmentation boundary, morphological opening operation is used to remove small noise areas by first erosion and then dilation, and finally, a watershed algorithm based on distance transform is used to refine the segmentation of adhered biological individuals, and finally, an accurate multi-class segmentation mask is output.
[0012] Furthermore, the hierarchical attention includes two sub-modules: region-level attention and instance-level attention, which work together to achieve background suppression and separation of overlapping individuals. The region-level attention sub-module adopts a channel-space joint attention structure. Channel attention adaptively adjusts the weights of different feature channels through a squeeze-excitement (SE) mechanism to enhance the response of biological attachment-related features. Spatial attention generates a spatial attention map to weight and enhance the biological attachment region in the image, suppressing the feature response of interfering regions. The instance-level attention sub-module is jointly guided by boundary response and center response. It extracts the edge gradient information of the feature map through the Sobel operator and combines it with the predicted target center heatmap to perform attention weighting on the overlapping biological individual regions, enhance the feature discrimination of the overlapping boundary, and assist the model in accurately segmenting overlapping individuals.
[0013] Furthermore, the morphological adaptation module dynamically adjusts the convolution parameters of the model by analyzing the local texture features of the input feature map, thereby achieving differentiated identification of hard-shelled, soft-bodied, and complex communities. The specific process is as follows: First, the feature map is divided into image blocks of fixed size, and the local texture features of each image block are extracted, including LBP local binary mode, Gabor texture response, and local contrast. Then, a lightweight classifier is used to determine the biological type corresponding to the image block. Finally, based on the determination result, the convolution dilation rate and convolution kernel type of the corresponding region are dynamically adjusted to optimize the segmentation effect of different biological types.
[0014] Furthermore, a multi-factor combined loss function is used to optimize the model parameters. The overall form of the loss function is as follows: Loss = λd×DiceLoss + λce×CrossEntropyLoss + λb×BoundaryLoss, Wherein λd, λce, and λb are the weight coefficients of Dice Loss, CrossEntropy Loss, and Boundary Loss, respectively. After experimental optimization, the values are λd=0.3, λce=0.5, and λb=0.2. The boundary loss includes an edge consistency term based on the Sobel operator. By using binary cross-entropy (BCE) to calculate the edge gradient difference between the predicted probability map and the real label map, the model's segmentation accuracy for biological edges is enhanced.
[0015] Furthermore, the model also includes a core region detection module. By defining a specific detection area of 1m×1m on the surface of marine structures, and combining OpenCV fast detection technology with heatmap visualization methods, it achieves efficient calculation of the biofouling coverage area. The calculation is then compared and fused with the prediction results of the deep learning model, balancing both speed and accuracy. Specifically, this includes the following: Region delineation and extraction: In the critical area of marine structure safety, a 1m×1m detection area is delineated by physical marking and image coordinate calibration. Based on the camera calibration parameters of OpenCV, the mapping relationship between physical size and image pixels is established, the pixel side length of the contour is calculated, and then the pixel-to-meter conversion factor k is obtained. According to the conversion factor, the pixel area corresponding to 1m×1m is accurately selected in the image, and then the area is marked to generate a ROI image of the specific area. Subsequent detection is only performed on the ROI image. Rapid detection of biological growth status: Set the typical color threshold range of marine organism attachment, initially screen out the target area, extract the outline of the biological attachment area based on the edge detection results, set the minimum outline area threshold to filter out noisy outlines, and combine the conversion coefficient k to calculate the actual biological attachment coverage area or number of organisms, and calculate the coverage ratio. Heatmap rendering and visualization: The ROI image is divided into a 100×100 pixel grid, with each sub-grid corresponding to a physical size of 1cm×1cm. The number of biologically attached pixels in each sub-grid is counted, and a density matrix M with a size of 100×100 is constructed. The matrix element value is the percentage of attached pixels in the corresponding sub-grid. The density matrix M is mapped to a pseudo-color heatmap using the OpenCV applyColorMap function. The total area, actual attached area, and coverage percentage of the detected region are labeled on the image using the cv2.putText function. The comparison and fusion mechanism with deep learning model results is as follows: The ROI image of a specific region is input into the trained deep learning model to obtain a precise segmentation mask of biological attachments in that region, ensuring that the two types of results are aligned based on the pixel coordinate system of the same ROI region. A difference threshold T is set, and the coverage ratio difference ΔR between the two types of results is calculated. If ΔR≤T, it indicates that the two types of results are consistent, and the OpenCV fast detection result is output, with the deep learning result used as the verification basis. If ΔR>T, it indicates that there is a detection bias, and the precise segmentation result of deep learning is automatically output, and the location and features of the biased region are recorded to provide data support for subsequent OpenCV threshold parameter optimization.
[0016] The beneficial effects of this invention include at least the following: The method proposed in this invention is highly targeted and tailored to the morphology and imaging characteristics of marine organism attachments. It significantly enhances the identification of boundaries and small targets by employing region-level and instance-level attention and boundary loss techniques, resulting in high segmentation accuracy. Furthermore, the method exhibits strong adaptability; its morphological adaptation module effectively improves the unified identification of attachment organisms in hard-shelled, soft-bodied, and complex communities. This invention provides a complete workflow from acquisition, preprocessing, segmentation to quantitative evaluation, supports multi-platform deployment, and has broad application prospects. Attached Figure Description
[0017] Figure 1 This is a schematic diagram of the process for precise segmentation and fusion detection of biological attachment in one embodiment of the present invention; Figure 2 This is a diagram illustrating the preliminary image recognition process in one embodiment of the present invention; Figure 3 This is an example of some labels in one embodiment of the present invention; Figure 4 This is a schematic diagram of the structure of the model of the present invention; Figure 5 This is an example of a segmentation mask after model processing in one embodiment of the present invention; Figure 6 This is a heatmap of biofilm coverage in the core observation area in one embodiment of the present invention; Figure 7 This is a report on the growth trend of biological attachment in the core observation area in one embodiment of the present invention. Detailed Implementation
[0018] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0019] This invention uses data construction, precise segmentation, key monitoring, dynamic tracking, and result fusion as its core logic to construct an integrated detection system for marine biological attachments. The various modules work together to ensure detection accuracy and engineering practicality. A schematic flowchart of the method for precise segmentation and fusion detection of biological attachments on bridge piers according to a specific embodiment of this invention is shown below. Figure 1 As shown.
[0020] First, based on the preprocessed bridge pier images, a dedicated dataset was constructed using OpenCV for initial identification and LabelMe for precise annotation. The dataset was then divided into training, validation, and test sets in a 7:2:1 ratio, and supplemented with metadata such as biological coverage to provide high-quality data support for model training.
[0021] The core deep learning model adopts an improved U-Net / Mask R-CNN architecture, which integrates multi-scale feature fusion, hierarchical attention and morphological adaptation modules. After optimization training by combined loss function, it achieves accurate segmentation of attachments such as hard shells, soft bodies and composite communities. The boundaries are then refined by CRF and watershed algorithms.
[0022] For monitoring key areas, a specific area detection module delineates a 1m×1m area, uses OpenCV to quickly calculate the attachment area and generate a density heatmap, and then compares and merges this with the deep learning results at a 5% difference threshold, balancing efficiency and accuracy. The critical area tracking module ensures long-term monitoring continuity, ultimately outputting quantitative results including coverage area, density, heatmap, and cleanup priority, forming a complete technical chain from data construction to engineering decision-making.
[0023] 1. Image preprocessing In this embodiment, the preprocessing module can adopt a scene-adaptive selection strategy. Based on the imaging characteristics of the image acquisition scene (e.g., underwater turbidity / low light, strong reflection in splash zones, and clear intertidal zones), it selectively selects and combines four core processing steps: color correction, dehazing / debackscattering, noise reduction, and distortion correction. This ensures that the images input to the subsequent segmentation model meet the requirements of feature distinguishability, controllable noise, and elimination of geometric distortion. After processing, key data needs to be extracted to guide subsequent label setting, model training, and heatmap creation. The detailed implementation process for each step is as follows: (1) Color Correction: By adjusting the gain of each channel, the average values of the three channels are balanced, thereby eliminating color cast. Combining the characteristics of blue-green cast in underwater ocean, this invention optimizes the traditional gray-world algorithm by increasing the channel weight coefficient. The RGB image acquired underwater is read, the image data is converted into floating point type, and then the pixel average value of the three channels is calculated. The global gray-scale average value is calculated based on the three channel average values as the benchmark for color balance. The gain coefficient of each channel is calculated according to the difference between the global gray-scale average value and the average value of each channel. The gain coefficient of each channel is multiplied by the pixel matrix of the corresponding channel to obtain the corrected single-channel image.
[0024] Input underwater RGB image pixel matrix Its size is ,in H, W The input image contains the height and width, and 3 represents the number of channels. The pixel matrix of the c-th channel is... , Its average pixel value is ,in Let be the coordinates of the pixel in the image, and let the global average grayscale value be . Based on the difference between the global grayscale mean and the mean values of each channel, the gain coefficient of each channel is calculated. The formula is This leads to the corrected single-channel pixel matrix. To avoid the corrected pixel values exceeding the range of the image data type, a pixel value truncation operation needs to be added. The optimized formula is as follows: ,in This is a truncation function.
[0025] (2) Eliminating marine environmental scattering interference: Backscattered light in underwater images can be considered as a superposition of "atmospheric light + scattering coefficient × transmission rate". The transmission rate is estimated through the dark channel to separate backscattered light from target reflected light. First, the dark channel of the image is calculated to form a dark channel image. The 0.2% of pixels with the highest brightness in the dark channel image are selected, and the average brightness of these pixels in the original image is taken as the atmospheric light value A. The transmission rate is calculated based on the dark channel and atmospheric light values to reflect the proportion of target light reaching the camera. Finally, the target image is recovered, and backscattering interference is eliminated. Specifically, this includes: Constructing an underwater image degradation model: ,in To observe the image, The real image to be recovered, i.e., the target image. For transmission rate, Atmospheric light value; Calculate the dark channel of the observed image: , For local neighborhood windows, the window size can be taken from experience or set as needed.
[0026] Estimate atmospheric light value A: Select the 0.2% pixel with the highest brightness in the dark channel image, corresponding to the location set S of the original image, and calculate the mean value of each channel in S.
[0027] Calculate the transmission rate: ,in Take 0.9.
[0028] Restore the target image: .
[0029] (3) Suppressing marine environmental noise interference: A combined strategy of coarse noise reduction followed by fine noise reduction is adopted. For conventional noise, bilateral filtering is used first. For motion noise caused by water flow disturbance and equipment vibration, adaptive median filtering is used.
[0030] (4) Distortion correction: A scheme combining camera calibration and distortion parameter correction is adopted, specifically including: Camera calibration: Obtaining camera intrinsic parameters (focal length and pixel equivalent) , Principal point coordinates , ) and distortion parameters (radial distortion coefficient) , , Tangential distortion coefficient , ).
[0031] Inverse coordinate mapping: for each pixel of the corrected image The non-integer position corresponding to it in the original distorted image is calculated by calibrating the parameters. Two-way interpolation filling: Decomposed into , Decomposed into Extract from the original image The gray values of the four neighboring pixels are obtained using the formula: The grayscale value of the corrected pixel is calculated, thus completing the distortion correction of the entire image.
[0032] 2. Intertidal zone bridge pier dataset Over two years, 500 images of concrete bridge piers with marine organisms attached in nearshore areas were collected, primarily in sizes of 2560×1440. This invention improves upon traditional labeling methods for biometric datasets by labeling not only specific biological categories but also "biological communities," classifying these communities based on equivalent cover density and dominant organisms. The main steps are as follows: (1) Preliminary OpenCV recognition: such as Figure 2 As shown, after preprocessing, the RGB image is first converted to grayscale. Preliminary differentiation of attachment types is achieved through joint screening using gradient threshold and contour threshold. The Canny edge detection algorithm is used to extract image gradient information, highlighting the edge features of biological attachments. Based on the characteristics of hard-shelled organisms (shellfish, barnacles, oysters, etc.) having steep edges and high gradient values, and soft-bodied organisms (algae, hydra) having gentle edges and low gradient values, gradient threshold ranges are set. High gradient thresholds greater than 100 correspond to candidate regions for hard-shelled organisms, while low gradient thresholds of 50-100 correspond to candidate regions for soft-bodied organisms. Adaptive threshold segmentation is performed on the gradient-classified images to generate binary images. Contours are extracted using the cv2.findContours function, and area thresholds are set to filter out noise points and excessively large interference areas. Combining the gradient range and contour morphology (hard-shelled organisms have regular contours and sharp angles, while soft-bodied organisms have irregular contours and continuous edges), preliminary classification results and corresponding candidate regions for hard-shelled and soft-bodied attachments are output. For areas where various organisms grow in a mixed manner, making classification difficult, the overall outline, area, and dominant organism species of the area are output. Pixels of the exposed concrete piers and the areas with attached organisms are extracted to calculate the equivalent biological coverage. The analyzed data is combined with the original image to improve the model's processing efficiency and the accuracy of subsequent semantic segmentation.
[0033] (2) Labeling and Image Segmentation: Based on the OpenCV recognition results, a usable dataset for deep learning was constructed through the following steps: First, label enhancement: using the contours extracted by OpenCV as a basis, the LabelMe tool was used to accurately label four types of regions (hard shell, soft body, composite community, and interfering background), supplementing the background label of exposed bridge piers to form a semantic segmentation label map; Second, data association: the calculated biological coverage, dominant biological species, and other attributes were used as label metadata and bound to the corresponding images and label maps; Third, data augmentation: the labeled data was subjected to enhancement operations such as flipping, scaling, and brightness perturbation to expand the dataset size; Fourth, format conversion: the label files (JSON format) were converted into a mask format (such as PNG) adapted to the deep learning framework, and the training set, validation set, and test set were divided in a 7:2:1 ratio to ensure the accuracy and distribution balance of the dataset labels and improve the model training effect. Some label examples are shown below. Figure 3 As shown.
[0034] 3. Framework of the training model 1) Infrastructure selection and overall framework The model architecture prioritizes improved U-Net or Mask R-CNN, and enhances multi-scale feature representation capabilities by fusing FPN and ASPP modules. Taking improved U-Net as an example... Figure 4As shown, the overall framework is divided into two parts: an encoder (downsampling) and a decoder (upsampling). The encoder adopts a stacked structure of convolutional layers + batch normalization + activation function (ReLU), and uses max pooling to achieve feature downsampling, gradually extracting high-level semantic features of the image. The decoder achieves feature upsampling through transposed convolution, and at the same time makes skip connections with the feature maps of the corresponding layers of the encoder to supplement low-level detailed features. An ASPP module is added between the encoder and the decoder to expand the receptive field without reducing the resolution and capture biological attachment features at different scales.
[0035] 2) Core Enhancement Module Design (1) Multi-scale feature fusion module This module achieves collaborative extraction of macroscopic and microscopic features through a parallel dual-branch structure. The specific design is as follows: The first branch (macroscopic feature branch) employs a combination of three parallel 3×3 dilated convolutions (dilation rates of 2, 4, and 6) and four-scale pyramid pooling (pooling scales of 1×1, 2×2, 4×4, and 8×8). The output feature maps of both the dilated convolutions and pyramid pooling are reduced to 256 channels via 1×1 convolutions. After channel concatenation, they are fused into a 256-channel macroscopic feature map via another 1×1 convolution, focusing on extracting the community contours and spatial distribution features of biological attachments. The second branch (microscopic feature branch) employs four layers of 3×3 convolutions with a high-resolution preservation strategy. Only one 2×2 max pooling is performed after the last convolution layer. Each convolution layer outputs 256 channels. Through a design without additional downsampling, it meticulously captures the edge and texture features of biological individuals, outputting a 256-channel microscopic feature map. Bilinear interpolation is used to upsample the macroscopic feature map to match the microscopic feature map. Figure 1 The resolution is consistent (1 / 2 scale of the input feature map). The two branch feature maps are concatenated in the channel dimension to form a 512-channel feature map. The dimensionality of the 512-channel feature map is reduced to 256 channels by 1×1 convolution. Batch normalization (BN) and ReLU activation functions are applied to reduce parameter redundancy. The final output is a multi-scale fused feature that combines global vision and detail accuracy.
[0036] (2) Attention mechanism module The module comprises two sub-modules: region-level attention and instance-level attention, which work together to achieve background suppression and overlapping individual separation. The regional attention submodule employs a channel-spatial joint attention structure. Its core is the adaptive adjustment of feature channel weights and spatial region weights, prioritizing the enhancement of feature responses related to biofouling while suppressing features from irrelevant regions such as seawater and exposed background structures. The main calculation process is as follows: Channel attention unit (based on SE squeezing-excitation mechanism) Input: Multi-scale fused feature map Compression: Global average pooling is performed on the feature map of each channel, compressing the two-dimensional features into a global feature vector of the channel dimension. : ,in This represents the global feature value of the c-th channel. For the c-th channel, the position is... The eigenvalue at that location.
[0037] Incentive: Channel weight vectors are generated by learning the dependencies between channels through two fully connected (FC) layers. .
[0038] Channel-weighted: The weight vector s is element-wise multiplied with the original feature map F along the channel dimension to obtain the channel-weighted feature map. Spatial attention unit Input: Channel-weighted feature map Feature compression: for Global average pooling and global max pooling are calculated separately along the channel dimension to obtain two single-channel feature maps. and The two are then concatenated along the channel dimension to obtain the concatenated feature map. .
[0039] Spatial weight generation: for Perform convolution to generate a spatial attention weight map. With weight value Spatial weighting: Weighting the spatial graph and Element-wise multiplication is performed to obtain the region-level attention-weighted feature map. .
[0040] The instance-level attention submodule, guided by both boundary and center responses, extracts edge gradient information from the feature map using the Sobel operator. Combined with the predicted target center heatmap, it applies attention weighting to overlapping biological individual regions, enhancing the feature discriminative power of overlapping boundaries and assisting the model in accurately segmenting overlapping individuals. The main calculation process is as follows: Input: Regional attention-weighted feature map .
[0041] Boundary response feature extraction: The Sobel operator is used to extract features from the boundary response features. For each channel feature map, gradients are calculated in the horizontal and vertical directions to obtain the horizontal gradient feature map. With vertical gradient feature map The gradient feature maps are fused into a boundary response map. , Central response feature extraction: Perform global average pooling along the channel dimension to obtain a single-channel feature map, and then... Convolution and sigmoid activation generate central response maps .
[0042] Instance attention weighting: Add each row of the boundary response map B and the center response map C element-wise to obtain the instance attention weight map jointly guided by the boundary and center. , weight graph and Multiplying them yields the final attention-enhanced feature map. .
[0043] (3) Morphology adaptive processing module The module analyzes the local texture features of the input feature map and dynamically adjusts the model's convolution parameters to achieve differentiated identification of hard-shelled, soft-bodied, and complex communities. The specific process is as follows: First, the feature map is divided into fixed-size image blocks, and the local texture features of each block are extracted (including LBP local binary pattern, Gabor texture response, and local contrast). Then, a lightweight classifier (such as a shallow convolutional neural network) is used to determine the corresponding biological type (hard-shelled, soft-bodied, complex community, and background) of the image blocks. Finally, based on the determination results, the convolution dilation rate and kernel type of the corresponding region are dynamically adjusted to optimize the segmentation effect for different types of organisms. The main steps are as follows: The first step is feature map segmentation and local texture extraction. The feature map, after multi-scale fusion and attention enhancement, is received and segmented into blocks using a 16×16 pixel sliding window and an 8-pixel stride (50% overlap to avoid edge feature loss). For each image block, three types of core texture features are extracted in parallel: LBP local binary mode (3-pixel radius, 8-neighborhood) to encode grayscale differences and distinguish between two types of biological textures; Gabor texture response (4 directions, 3 scales) to capture orientation-specific textures; and local contrast features (grayscale extreme value difference) to quantify the contrast difference between the biological object and the background. These three types of features are concatenated into a local feature vector of a unified dimension to complete the morphological representation.
[0044] The second step is lightweight morphology classification. A lightweight 3-layer convolutional network is constructed to classify feature vectors: after 1×1 convolution dimensionality reduction, BatchNorm+ReLU activation, and 3×3 convolution feature interaction, it outputs the probabilities of four classes: hard shell, soft body, composite community, and background. The network is pre-trained on a dedicated dataset and optimized with cross-entropy loss, achieving a classification accuracy of ≥90%, providing a basis for parameter adjustment.
[0045] The third step is dynamic adaptation of convolutional parameters. Based on the classification results, the convolutional parameters are dynamically adjusted: for hard-shell classes, a 3×3 convolutional kernel with a dilation rate of 1 (stride 2) is used to enhance edge and texture aggregation; for soft-body classes, a 5×5 convolutional kernel with a dilation rate of 2 (stride 1) is used to adapt to the extended shape; for complex community classes, parallel convolutions with multiple dilation rates are used to fuse multi-scale features; and for background classes, a 1×1 convolutional kernel with a dilation rate of 4 is used to weaken interference. Parameter adjustment is achieved through deformable convolutions, without increasing network complexity and ensuring real-time performance.
[0046] This design can dynamically optimize feature extraction strategies, improve the segmentation accuracy and class distinction ability of organisms with different morphologies, and solve the problem of poor adaptability of general models to morphologically heterogeneous targets.
[0047] 3) Training strategy and loss function design The model was trained using a constructed dataset of marine organism attachments (containing pixel-level annotations of hard-shelled, soft-shelled, hybrid, and background organisms). During training, multiple combined loss functions were used to optimize the model parameters. The overall form of the loss function is: Loss = λd×DiceLoss + λce×CrossEntropyLoss + λb×BoundaryLoss, where λd, λce, and λb are the weight coefficients of the Dice loss, cross-entropy loss, and boundary loss, respectively (optimized experimentally to λd=0.3, λce=0.5, and λb=0.2). The boundary loss includes an edge consistency term based on the Sobel operator, which enhances the model's accuracy in segmenting biological edges by calculating the difference in edge gradients between the predicted probability map and the ground truth label map (using binary cross-entropy BCE). The boundary loss function is: .in The values represent the pixel values of the ground truth boundary label map, which is a binary matrix with the same dimensions as the input image. The ground truth boundary label map is obtained by extracting edges from the ground truth semantic segmentation label map using the Sobel operator, and the extraction parameters are the same as the edge detection parameters in the morphological adaptation module. The pixel value of the predicted boundary probability map is in the range of [0,1]. It is obtained by extracting the edge gradient from the predicted probability map output by the model through the Sobel operator and then mapping it through the Sigmoid activation function, representing the probability that the pixel is an edge. , This is the class weight coefficient, used to balance the sample imbalance problem between edge pixels and non-edge pixels. In this invention, after experimental optimization, the following can be taken: , This boundary loss quantifies the gradient difference between the predicted edge and the actual edge, guiding the model to focus on learning the boundary region features of biological attachment. Combined with Dice loss (to improve the consistency of segmented regions) and cross-entropy loss (to optimize the accuracy of category classification), it forms a combined loss function that comprehensively improves segmentation performance.
[0048] During training, a stochastic gradient descent (SGD) optimizer is used to minimize the combined loss function. The optimizer parameters are set as follows: momentum coefficient 0.9, weight decay coefficient 1e-4. The learning rate is dynamically adjusted using a cosine annealing strategy, with an initial learning rate of 1e-3, which is adaptively adjusted after each training round based on the loss changes to avoid the model getting trapped in local optima. Simultaneously, multi-scale training (input image size randomly scaled to 256×256 and 512×512) and mixed-precision training strategies are employed to improve training efficiency and model generalization ability.
[0049] 4) Predictive Output and Post-processing Module Multi-scale fused features are mapped to a prediction probability map with the same size as the input image through the final convolutional layer. This probability map is then converted into pixel-level class prediction results using the argmax function, yielding the initial segmentation mask. To further improve segmentation accuracy, post-processing operations are performed on the initial segmentation mask: a Conditional Random Field (CRF) is used to optimize the smoothness of the segmentation boundaries; morphological opening operations (erosion followed by dilation) are used to remove small noise regions; and finally, a watershed algorithm based on distance transform is used to refine the segmentation of adhered biological individuals, ultimately outputting an accurate multi-class segmentation mask. Figure 5 This is an example of the processed model. Based on segmentation masks, parameters such as the coverage area and density of various biological attachments can be calculated and compared with the results obtained from OpenCV and the heatmaps obtained from the auxiliary modules described later, ultimately providing data support for the safety assessment of marine structures.
[0050] 4. Core Area Detection This module is specifically designed for the critical monitoring needs of marine structures such as bridge piers. By defining a specific 1m×1m detection area on the pier surface, it combines OpenCV rapid detection technology with heatmap visualization methods to efficiently calculate the biofouling coverage area. The results are then compared and fused with predictions from a deep learning module, balancing speed and accuracy to provide precise and efficient data support for engineering operations and maintenance. The specific implementation process is as follows: (1) Region delineation and extraction: A 1m×1m detection area is delineated in key safety areas of the bridge pier structure (such as the boundary between the intertidal zone and the splash zone, and areas of concentrated pile stress). A mapping relationship between physical dimensions and image pixels is established based on OpenCV camera calibration parameters. The pixel side length of the contour is calculated, and the pixel-to-meter conversion factor k is obtained. Based on the conversion factor, the corresponding pixel region of 1m×1m is accurately selected in the image, and then this region is marked to generate a ROI (Region of Interest) image for that specific region. Subsequent detection is performed only on this ROI image, improving detection efficiency.
[0051] (2) Rapid detection of biological growth status: A typical color threshold range for marine organism attachment is set to initially screen out target areas. Based on the edge detection results, the contour of the biological attachment area is extracted, and a minimum contour area threshold (e.g., 50 pixels) is set to filter out noisy contours. Combined with the pixel-meter conversion coefficient k obtained above, the actual biological attachment coverage area or number of organisms is calculated, and the coverage ratio is calculated. The processing time of the entire OpenCV detection process is controlled within 100ms, meeting the needs of rapid inspection.
[0052] (3) Heatmap drawing and visualization: The ROI image is divided into a 100×100 pixel grid (each sub-grid corresponds to a physical size of 1cm×1cm). The number of biologically attached pixels in each sub-grid is counted, and a density matrix M (size 100×100) is constructed. The matrix element value is the percentage of attached pixels in the corresponding sub-grid. Using the OpenCV applyColorMap function, the density matrix M is mapped into a pseudo-color heatmap. The total area, actual attachment area, coverage ratio, and other key data of the detection area are labeled on the image using the cv2.putText function to improve the readability of the results.
[0053] (4) Comparison and fusion mechanism with deep learning module results: Input the ROI image of a specific region into the trained deep learning model to obtain the accurate segmentation mask of biological attachment in that region, ensuring that the two types of results are aligned based on the pixel coordinate system of the same ROI region. Set the difference threshold T (default is 5%), calculate the coverage ratio difference ΔR=|R_deep-R_opencv| between the two types of results. If ΔR≤T, it means that the two types of results are consistent. At this time, the OpenCV fast detection result is output (considering efficiency), and the deep learning result is used as the verification basis. If ΔR>T, it means that there is a detection deviation. At this time, the accurate segmentation result of deep learning is automatically output (ensuring accuracy), and the location and characteristics of the deviation area (such as whether it is a densely overlapping community, whether there is strong reflective interference, etc.) are recorded to provide data support for subsequent OpenCV threshold parameter optimization. The heat map of biological attachment coverage in the core observation area and the growth trend report are as follows. Figure 6 , Figure 7 As shown.
[0054] In other embodiments of the present invention, the backbone network can also be replaced with MobileNet / ConvNeXt to adapt to computing power, the ASPP expansion rate and the number of FPN layers can be adjusted according to the target scale distribution, the attention can be replaced with Transformer self-attention or gated attention, the post-processing CRF can be omitted or replaced by lightweight boundary refinement convolution, and morphological adaptation can also be achieved through meta-learning or conditional convolution (CondConv / HyperNet).
[0055] This invention possesses strong industrial applicability and broad industry adaptability. Besides the nearshore concrete bridge piers highlighted in this project, it can also deeply empower multiple core marine engineering fields such as offshore wind power, port and waterway engineering, cross-sea bridges, and shipping, providing full-process, high-precision technical support for the operation and maintenance management of their structures. In the offshore wind power sector, it can be deployed for routine inspections of key structures such as wind turbine pile foundations and jacket structures. By accurately outputting data on the area, density, and spatiotemporal evolution of biofouling in different sea areas (nearshore / offshore) and environments (intertidal zone / splash zone / underwater), it provides quantitative basis for determining the maintenance cycle of antifouling coatings and optimizing cathodic protection systems, effectively reducing the risk of structural damage caused by biofouling corrosion and extending equipment lifespan. In port and waterway and bridge engineering, for structures such as wharf pile foundations and bridge piers, it can leverage the advantages of multi-platform deployment such as drones and ROVs to achieve comprehensive detection of hard-to-reach areas. The generated biofouling heat map can directly guide the planning of cleaning operation paths, significantly improving cleaning efficiency and reducing manual inspection and operation costs. In the shipping industry, this invention can be applied to the detection of biofouling on ship hulls, quantifying the impact of fouling levels on navigation resistance, and providing data support for ship antifouling treatment and energy conservation and emission reduction solutions. This invention employs a containerized deployment and edge computing architecture, which can flexibly adapt to different computing power scenarios, is compatible with communication methods such as 5G / Ethernet, and has breakpoint resume and batch processing capabilities. It can be quickly integrated into existing engineering operation and maintenance systems without large-scale modification of existing equipment, resulting in low promotion costs and rapid effectiveness, demonstrating significant economic and social value.
[0056] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0057] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0058] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0059] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0060] The embodiments described above are merely some preferred embodiments of the present invention, and are not intended to limit the invention. Those skilled in the art can make various changes and modifications without departing from the spirit and scope of the invention. Therefore, all technical solutions obtained by equivalent substitution or equivalent transformation fall within the protection scope of the present invention.
Claims
1. A method for precise segmentation and fusion detection of bioattachment on marine structures, characterized in that, include: The collected images of marine structures are preprocessed and then input into a trained core deep learning model for further processing. The model outputs accurate segmentation results for different types of biological attachments and monitoring results for key areas. The core deep learning model adopts an improved U-Net / Mask R-CNN architecture, integrating multi-scale feature fusion, hierarchical attention, and morphological adaptation modules. After optimization training using a combined loss function, it achieves accurate segmentation of different types of biological attachments. The boundaries are then refined using a Conditional Random Field (CRF) and a watershed algorithm. The preprocessed images are pre-identified using OpenCV and precisely labeled with LabelMe to construct a dedicated dataset, which is divided into training, validation, and test sets. Metadata on biological coverage is added for model training.
2. The method for precise segmentation and fusion detection of bioattachment on marine structures according to claim 1, characterized in that, The acquired images of marine structures are preprocessed, which includes four core processing steps: color correction, dehazing / debackscattering, noise reduction, and distortion correction.
3. The method for precise segmentation and fusion detection of bioattachment on marine structures according to claim 1, characterized in that, The preprocessing specifically includes: (1) Color correction: By adjusting the gain of each channel, the average values of the three channels are balanced, thereby eliminating color cast. Specifically, the following steps are taken: convert the RGB image data collected underwater into floating point type, and then calculate the pixel average value of each of the three channels. The global grayscale average value is calculated based on the average value of the three channels as the benchmark for color balance. The gain coefficient of each channel is calculated according to the difference between the global grayscale average value and the average value of each channel. The gain coefficient of each channel is multiplied by the pixel matrix of the corresponding channel to obtain the corrected single-channel image. (2) Eliminate marine environmental scattering interference: The backscattered light of the underwater image is regarded as the superposition of "atmospheric light + scattering coefficient × transmission rate". The transmission rate is estimated through the dark channel to separate the backscattered light from the target reflected light. Specifically, the dark channel of the image is calculated first to form a dark channel image. The 0.2% of the pixels with the highest brightness in the dark channel image are selected. The average brightness of these pixels in the original image is taken as the atmospheric light value A. The transmission rate is calculated based on the dark channel and the atmospheric light value to reflect the proportion of target light reaching the camera. Finally, the target image is restored to eliminate backscattering interference. (3) Suppress marine environmental noise interference: adopt a combination strategy of coarse noise reduction followed by fine noise reduction, specifically including: first use bilateral filtering for noise reduction, and then use adaptive median filtering for motion noise caused by water flow disturbance and equipment vibration. (4) Distortion correction: The camera calibration and distortion parameter correction scheme is adopted, which specifically includes: before acquiring the image, the acquisition device is calibrated using a checkerboard calibration board to obtain the camera's inherent parameters and distortion parameters, and the pixel values of the corrected image are filled using a bilinear interpolation algorithm.
4. The method for precise segmentation and fusion detection of bioattachment on marine structures according to claim 1, characterized in that, The methods for constructing the dedicated dataset include the following: Images of concrete marine structures with attached marine organisms in nearshore areas were collected, and images were standardized in size. Organisms in the images were identified and labeled. In addition to labeling specific organism categories, labels were also created targeting biological communities, which were further classified based on equivalent cover density and dominant organisms. The main methods are as follows: 1) OpenCV preliminary recognition: After preprocessing, the RGB image is first converted into a grayscale image. The attachment type is initially distinguished by the joint screening of gradient threshold and contour threshold. The Canny edge detection algorithm is used to extract image gradient information to highlight the edge features of biological attachment. Based on the characteristics of hard-shelled organisms (steep edges and high gradient values) and soft-bodied organisms (smooth edges and low gradient values), gradient threshold ranges are set. High gradient thresholds (greater than 100) correspond to candidate regions for hard-shelled organisms, while low gradient thresholds (50-100) correspond to candidate regions for soft-bodied organisms. Adaptive threshold segmentation is performed on the gradient-classified images to generate binary images. Contours are extracted using the cv2.findContours function, and area thresholds are set to filter out noise points and excessively large interference areas. Combining the gradient ranges and contour morphology, preliminary classification results and corresponding candidate regions for hard-shelled and soft-bodied organism attachments are output. For regions where various organisms grow mixed and classification is difficult, the overall contour, area, and dominant organism species of the region are output. Pixels of exposed and attached portions of concrete marine structures are extracted to calculate the equivalent biological coverage. The analyzed data is combined with the original image to improve model processing efficiency and subsequent semantic segmentation accuracy. 2) Labeling and Image Segmentation: Based on the OpenCV recognition results, a usable dataset for deep learning is constructed through the following steps: First, label enhancement: Based on the contours extracted by OpenCV, the LabelMe tool is used to accurately label four types of regions, including hard shells, soft bodies, complex communities, and interfering backgrounds, supplementing the background labels of exposed marine structures to form a semantic segmentation label map; Second, data association: Calculated attributes such as biological coverage and dominant species are used as label metadata and bound to the corresponding images and label maps. Third, data augmentation involves performing augmentation operations such as flipping, scaling, and brightness perturbation on the labeled data to expand the dataset size. Fourth, format conversion: the labeled files are converted into a mask format compatible with deep learning frameworks, and the training set, validation set, and test set are divided in a 7:2:1 ratio to ensure the accuracy and balanced distribution of dataset labels and improve model training performance.
5. The method for precise segmentation and fusion detection of bioattachment on marine structures according to claim 1, characterized in that, The core deep learning model adopts an improved U-Net, which includes two parts: an encoder and a decoder. The encoder adopts a stacked structure of convolutional layers, batch normalization, and ReLU activation function, and uses max pooling to achieve feature downsampling and gradually extract high-level semantic features of the image. The decoder achieves feature upsampling through transposed convolution and simultaneously performs skip connections with the feature maps of the corresponding layers of the encoder to supplement low-level detailed features. An ASPP module is added between the encoder and decoder to expand the receptive field without reducing resolution and to capture biological attachment features at different scales.
6. The method for precise segmentation and fusion detection of bioattachment on marine structures according to claim 1, characterized in that, The multi-scale feature fusion achieves collaborative extraction of macroscopic and microscopic features through a parallel dual-branch structure. The specific design is as follows: The first branch is the macroscopic feature branch, employing a combination of dilated convolution and pyramid pooling to extract large-scale features of the community outline and spatial distribution of biological attachments. The dilation rates of the dilated convolutions are 2, 4, and 6, and the scales of the pyramid pooling are 1×1, 2×2, 4×4, and 8×8. The second branch is the microscopic feature branch, employing a 3×3 small convolution kernel and a high-resolution feature preservation strategy. By reducing pooling operations and increasing the number of convolutional layers, it precisely captures the edge and texture details of individual organisms. After feature alignment, the feature maps output by the two branches are spliced and fused along the channel dimension. After fusion, 1×1 convolution is used to reduce parameter redundancy, ultimately obtaining a multi-scale fused feature that combines global perspective and detailed accuracy. Multi-scale fusion features are mapped to a prediction probability map with the same size as the input image through the final convolutional layer. The probability map is converted into pixel-level class prediction results through the argmax function to obtain the initial segmentation mask. Post-processing operations are performed on the initial segmentation mask: Conditional Random Field (CRF) is used to optimize the smoothness of the segmentation boundary, morphological opening operation is used to remove small noise areas by first erosion and then dilation, and finally, a watershed algorithm based on distance transform is used to refine the segmentation of adhered biological individuals, and finally, an accurate multi-class segmentation mask is output.
7. The method for precise segmentation and fusion detection of bioattachment on marine structures according to claim 1, characterized in that, The hierarchical attention mechanism comprises two sub-modules: region-level attention and instance-level attention. These sub-modules work together to suppress background interference and separate overlapping individuals. The region-level attention sub-module employs a channel-space joint attention structure. Channel attention adaptively adjusts the weights of different feature channels through a squeeze-excitement (SE) mechanism to enhance the response of biological attachment-related features. Spatial attention generates a spatial attention map to weight and enhance biological attachment regions in the image, suppressing the feature responses of interfering regions. The instance-level attention sub-module is guided by a combination of boundary and center responses. It extracts edge gradient information from the feature map using the Sobel operator and combines it with the predicted target center heatmap to weight attention on overlapping biological regions, enhancing the feature discrimination of overlapping boundaries and assisting the model in accurately segmenting overlapping individuals.
8. The method for precise segmentation and fusion detection of bioattachment on marine structures according to claim 1, characterized in that, The morphological adaptation module analyzes the local texture features of the input feature map and dynamically adjusts the convolution parameters of the model to achieve differentiated identification of hard-shelled, soft-bodied, and complex communities. The specific process is as follows: First, the feature map is divided into image blocks of fixed size, and the local texture features of each image block are extracted, including LBP local binary pattern, Gabor texture response, and local contrast. Then, a lightweight classifier is used to determine the biological type corresponding to the image block. Finally, based on the determination result, the convolution dilation rate and convolution kernel type of the corresponding region are dynamically adjusted to optimize the segmentation effect of different biological types.
9. The method for precise segmentation and fusion detection of bioattachment on marine structures according to claim 1, characterized in that, The model parameters are optimized using a combination of multiple loss functions. The overall form of the loss function is as follows: Loss = λd×DiceLoss + λce×CrossEntropyLoss + λb×BoundaryLoss, Wherein λd, λce, and λb are the weight coefficients of Dice Loss, CrossEntropy Loss, and Boundary Loss, respectively. After experimental optimization, the values are λd=0.3, λce=0.5, and λb=0.
2. The boundary loss includes an edge consistency term based on the Sobel operator. By using binary cross-entropy (BCE) to calculate the edge gradient difference between the predicted probability map and the real label map, the model's segmentation accuracy for biological edges is enhanced.
10. The method for precise segmentation and fusion detection of bioattachment on marine structures according to claim 1, characterized in that, The model also includes a core region detection module. By defining a specific 1m×1m detection area on the surface of marine structures, and combining OpenCV fast detection technology with heatmap visualization methods, it achieves efficient calculation of biofouling coverage area. The calculation is then compared and fused with the prediction results of a deep learning model, balancing both speed and accuracy. Specifically, it includes the following: Region delineation and extraction: In the critical area of marine structure safety, a 1m×1m detection area is delineated by physical marking and image coordinate calibration. Based on the camera calibration parameters of OpenCV, the mapping relationship between physical size and image pixels is established, the pixel side length of the contour is calculated, and then the pixel-to-meter conversion factor k is obtained. According to the conversion factor, the pixel area corresponding to 1m×1m is accurately selected in the image, and then the area is marked to generate a ROI image of the specific area. Subsequent detection is only performed on the ROI image. Rapid detection of biological growth status: Set the typical color threshold range of marine organism attachment, initially screen out the target area, extract the outline of the biological attachment area based on the edge detection results, set the minimum outline area threshold to filter out noisy outlines, and combine the conversion coefficient k to calculate the actual biological attachment coverage area or number of organisms, and calculate the coverage ratio. Heatmap rendering and visualization: The ROI image is divided into a 100×100 pixel grid, with each sub-grid corresponding to a physical size of 1cm×1cm. The number of biologically attached pixels in each sub-grid is counted, and a density matrix M with a size of 100×100 is constructed. The matrix element value is the percentage of attached pixels in the corresponding sub-grid. The density matrix M is mapped to a pseudo-color heatmap using the OpenCV applyColorMap function. The key data of the total area, actual attached area, and coverage percentage of the detected region are labeled on the image using the cv2.putText function. The comparison and fusion mechanism with deep learning model results is as follows: The ROI image of a specific region is input into the trained deep learning model to obtain a precise segmentation mask for biological attachments within that region, ensuring that the two types of results are aligned based on the pixel coordinate system of the same ROI region. A difference threshold T is set, and the coverage ratio difference ΔR between the two types of results is calculated. If ΔR≤T, it indicates that the two types of results are consistent, and the OpenCV fast detection result is output, with the deep learning result used as the verification basis. If ΔR>T, it indicates that there is a detection bias, and the precise segmentation result of deep learning is automatically output, and the location and features of the biased region are recorded to provide data support for subsequent OpenCV threshold parameter optimization.