A deep learning-based U-segformer oil spill detection method

By using the U-SegFormer model, which combines the Segformer and U-Net structures, and introducing the Effi-Transformer module and self-attention mechanism, the feature extraction and expression capabilities are optimized. The training is combined with cross-entropy and Dice loss, and thresholding and morphological operations are used in post-processing. This solves the problems of cumbersome and time-consuming traditional methods and the resolution limitations of remote sensing technology, and achieves efficient and precise oil spill detection.

CN118823596BActive Publication Date: 2026-11-24HUAIYIN INSTITUTE OF TECHNOLOGY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410968613.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-19
Publication Date
2026-11-24
Estimated Expiration
2044-07-19

AI Technical Summary

Technical Problem

Traditional oil spill detection methods are cumbersome, time-consuming, and costly. Remote sensing and radar technologies have limitations in terms of resolution and accuracy, and the Transformer model has high computational complexity, making it difficult to apply directly to the processing of high-resolution remote sensing images.

Method used

The U-SegFormer model is adopted, which combines the feature extraction capability of Segformer and the symmetric encoder-decoder structure of U-Net. The Effi-Transformer module is introduced, and the feature extraction and expression capabilities are optimized through self-attention mechanism and patch expanding technology. The model is trained by combining cross-entropy loss and Dice loss. In post-processing, thresholding and morphological operations are used to optimize the segmentation results.

Benefits of technology

It improves the segmentation accuracy and speed of oil spill detection, ensures good performance in different environments, and provides more refined and continuous segmentation results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118823596B_ABST
    Figure CN118823596B_ABST
Patent Text Reader

Abstract

A deep learning-based U-SegFormer oil spill detection method includes the following steps: Step 1: Data preparation: Oil spill images acquired by remote sensing satellites are used as experimental data, and the oil spill image data are manually labeled according to the oil spill level; a dataset is then created and divided into training, validation, and test sets according to a certain ratio; Step 2: Model building: The network architecture of the U-SegFormer model can be divided into three main parts: encoder, bottleneck layer, and decoder; Step 3: Model training: The U-SegFormer model is pre-trained and fine-tuned using a public dataset and the training and validation sets of the oil spill image dataset from Step 1 to obtain the segmentation model Y; Step 4: Post-segmentation processing: The model is tested using the test set of the oil spill image dataset from Step 1 to obtain the initial segmentation result, and then post-processing is performed to obtain the final segmentation result. This invention can effectively preserve and utilize high-resolution spatial information, and can better preserve and segment details.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of deep learning technology, specifically relating to a U-SegFormer oil spill detection method based on deep learning. Background Technology

[0002] Oil spills are serious environmental pollution incidents that typically occur during oil transportation, drilling, and production. Once an oil spill occurs, the oil spreads rapidly, polluting marine and coastal ecosystems, severely impacting the habitat of marine life, and even causing significant damage to human health and economic activities. Therefore, timely and accurate detection and monitoring of oil spills are essential. Traditional oil spill detection methods mainly rely on on-site sampling and laboratory analysis. While these methods are accurate, they are cumbersome, time-consuming, and costly. In addition, remote sensing and radar technologies are also widely used in oil spill detection and monitoring, but these methods still have limitations in terms of resolution and accuracy.

[0003] With the rapid development of deep learning technology, especially the widespread application of convolutional neural networks (CNNs) and Transformers in computer vision, deep learning-based image segmentation methods have shown great potential in oil spill detection. However, traditional image segmentation methods perform poorly when dealing with complex backgrounds and ever-changing environments. While the Transformer model excels at capturing global information, its high computational complexity makes it difficult to directly apply to the processing of high-resolution remote sensing images. Summary of the Invention

[0004] To address the technical problems of poor application performance, high computational complexity, and inaccurate or discontinuous segmentation results in the aforementioned fields, this technical solution provides a U-SegFormer oil spill detection method based on deep learning. The newly constructed model structure can effectively preserve and utilize high-resolution spatial information, enabling the model to better preserve and segment details when handling complex oil spill detection tasks. This improves both model training speed and segmentation accuracy, effectively solving the aforementioned problems.

[0005] This invention is achieved through the following technical solution:

[0006] A deep learning-based U-SegFormer oil spill detection method includes the following steps:

[0007] Step 1: Data preparation: Use oil spill images acquired by remote sensing satellites as experimental data, and manually label the oil spill image data according to the oil spill level to create a dataset; divide the dataset into training set, validation set and test set according to a certain ratio to ensure that the training set, validation set and test set contain the same proportion of images of different oil spill levels to ensure the generalization ability of the model.

[0008] Step 2: Model Building: The network architecture of the U-Segformer model can be divided into three main parts: encoder, bottleneck layer, and decoder. An image of size H×W×1 is input to the encoder, where H represents the image height, W represents the image width, and 1 represents the number of image channels. The encoder processes the input image step by step through three stages and outputs three feature maps of different resolutions. The feature map with the lowest resolution is input to the bottleneck layer, which further extracts global features and outputs the processed feature map to the decoder. The decoder goes through three stages and finally outputs the final segmentation result.

[0009] Step 3: Training the model: Use the training and validation sets of the public dataset and the oil spill image dataset from Step 1 to pre-train and fine-tune the U-SegFormer model to obtain the segmentation model Y;

[0010] Step 4: Post-segmentation processing. Use the test set of the oil spill image dataset from Step 1 to test the model and obtain the initial segmentation results. Then perform post-processing to obtain the final segmentation results.

[0011] Furthermore, the specific implementation process of the U-SegFormer model described in step 2 is as follows:

[0012] Step 2.1: Input an image of size H×W×1. The image passes through three stages of the encoder. Each stage contains one OPM module and two Effi-Transformer modules. The main role of the OPM module in the U-Segformer model is to optimize the processing and merging of feature maps. By improving the expressive power of features and computational efficiency, it helps the model achieve better results in oil spill image segmentation tasks. The three stages will output feature maps X. s1 X s2 X s3 ,in

[0013]

[0014] Step 2.2: Feature Map The feature map is fed into the bottleneck layer via an OPM module, where an Effi-Transformer module processes the lowest-resolution features and outputs a feature map.

[0015] Step 2.3: The output of the bottleneck layer increases the resolution of the feature map through Patch Expanding. The feature map is processed by two Effi-Transformer modules and combined with... The skip chain connection features, the output feature size is X r3 The resolution of the feature map is further increased through Patch Expanding. The features are processed by two Effi-Transformer modules and combined with... The skip connection features, the output feature size of this stage is X r2 The resolution of the feature map is further increased through Patch Expanding. The features are processed by two Effi-Transformer modules and combined with... The skip chain connection features, the output feature size of this stage is X r1 By using Patch Expanding, the feature map is restored to the resolution of the original input image, and the output feature size is H×W×C0.

[0016] Furthermore, the specific implementation process of the Effi-Transformer module described in step 2.1 is as follows:

[0017] Step 2.1.1: Use an image of size H×W×1 as input to the Effi-Transformer module;

[0018] Step 2.1.2: Use the self-attention mechanism Self-Attention (SAATN) to process the input feature map and capture global information;

[0019] Step 2.1.3: The output of the self-attention mechanism is further processed through a hybrid feedforward network Mix-FFN; Step 2.1.4: The final output feature map is used for subsequent processing.

[0020] Furthermore, the specific operation method of step 2.1.2 is as follows:

[0021] Step 2.1.2.1: Input a feature map of size N×C, where N is the spatial size of the feature map, such as the number of pixels in the feature map; and C is the number of channels.

[0022] Step 2.1.2.2: The input feature map is transformed into query Q, key K, and value V through three linear transformations:

[0023] ·Q=XW Q Generate a query matrix of size N×C;

[0024] ·K=XWK Generate a key matrix of size .

[0025] ·V=XW V Generate a value matrix of size .

[0026] Where X is the input feature map, W Q W K and W V It is the corresponding linear transformation matrix;

[0027] Step 2.1.2.3: Calculate the dot product of the query matrix and the key matrix, and perform scaling and softmax operations to obtain the attention weights:

[0028] Dot product: QK T The result size is

[0029] Scaling: Divide Where d i It is the dimension of the key matrix, usually equal to C;

[0030] Softmax: Apply the softmax function to the scaled result to obtain the attention weight matrix, which has a size of [value missing].

[0031] Step 2.1.2.4: Weighted Summation: Multiply the attention weight matrix by the value matrix V to obtain the weighted sum.

[0032] · The result size is N×C.

[0033] Furthermore, the specific operation method of step 2.1.3 is as follows:

[0034] Step 2.1.3.1: The feature map processed by the self-attention mechanism is first processed and transformed by a multilayer perceptron (MLP) layer;

[0035] Step 2.1.3.2: The feature map output by the MLP is passed through a 3×3 convolutional layer to capture local spatial features;

[0036] Step 2.1.3.3: The output of the convolutional layer is transformed using a GELU activation function;

[0037] Step 2.1.3.4: After convolution and activation functions, further feature processing and transformation are performed through another MLP layer.

[0038] Furthermore, the specific implementation process of the Patch Expanding module described in step 2.3 is as follows:

[0039] Step 2.3.1: Input a concatenated feature map, with a size of [size missing].

[0040] Step 2.3.2: Reduce the number of channels in the input feature map from 4C to C using a linear transformation to obtain the fused feature map, with a size of...

[0041] Step 2.3.3: Perform another linear transformation on the fused feature map, increasing the number of channels from C to 2C, and the size of the feature map is...

[0042] Step 2.3.4: Reshape the feature map as follows Increase spatial resolution;

[0043] Step 2.3.5: Finally, a linear transformation is used to convert the number of channels in the feature map from C / 2 to N. C This generates the final output mask, with a size of H×W×N. C .

[0044] Furthermore, the specific operation method of step 3 is as follows:

[0045] Step 3.1: Data Preprocessing: Preprocess the data, including normalization, image resizing, and data augmentation;

[0046] Step 3.2: Model Training: Define the learning rate, loss function, and training parameters;

[0047] Step 3.3: Input a batch of training data in each training round, calculate the loss, and update the model parameters according to the loss gradient; evaluate the model performance using the validation set and adjust the hyperparameters to optimize the model;

[0048] Step 3.4: Further fine-tune the U-SegFormer model using the training and validation sets of the self-made oil spill image dataset. In each training round, input a batch of self-made training data, calculate the loss, and update the model parameters according to the loss gradient. Use the validation set of the self-made dataset to validate and evaluate the model's performance in oil spill image segmentation.

[0049] Furthermore, the specific operation method of step 3.2 is as follows:

[0050] Loss function definition: For the U-SegFormer model, cross-entropy loss and Dice loss are combined to improve segmentation performance; the specific formula is as follows:

[0051] The formula for the Cross-Entropy Loss function is:

[0052]

[0053] In the above formula, y i The label is the actual label; if pixel i belongs to this category, then y... i =1, otherwise y i =0; p i This represents the probability that the model predicts pixel i belongs to a certain category;

[0054] The formula for the Dice loss function, Dice Loss, is:

[0055]

[0056] In the above formula, X and Y represent the predicted segmentation result and the true segmentation label, respectively, and |X∩Y| represents the number of intersection pixels between the segmented image predicted by the model and the true image;

[0057] Combining the cross-entropy loss function and the Dice loss function yields the loss function used for training:

[0058] L Total =α×L Diceloss +β×L Celoss

[0059] In the above formula, L Total This represents the value of the total loss function, where α and β are weighting coefficients used to balance the two types of loss.

[0060] Furthermore, the specific implementation process of post-processing the initial segmentation model described in step 4 is as follows:

[0061] Step 4.1: Thresholding: Convert the probability map output by the model into a binary mask map; typically, by setting a threshold, if the predicted probability is greater than the threshold, it is determined to be the target area, otherwise it is the background;

[0062] Step 4.2: Morphological operations: Apply morphological operations such as dilation and erosion to remove noise and smooth segmentation boundaries;

[0063] Step 4.3: Edge Detection and Refinement: Use edge detection algorithms to further refine edge segmentation;

[0064] Step 4.4: Combine the results from multiple post-processing steps and apply a smoothing algorithm to smooth the final segmentation boundaries.

[0065] Beneficial effects

[0066] The U-SegFormer oil spill detection method based on deep learning proposed in this invention has the following advantages compared with existing technologies:

[0067] (1) The main feature of U-Segformer in this invention is that it combines the feature extraction capability of Segformer with the symmetric encoder-decoder structure of U-Net to represent the Segformer model in a U-shaped architecture. Simultaneously, Effi-Transformer modules are introduced into both the encoder and decoder to further optimize feature extraction and representation capabilities, improve the model's sensitivity to details and boundaries, and thus enhance segmentation accuracy. Furthermore, skip connections ensure the utilization of high-resolution features during the decoding process, resulting in more refined segmentation results.

[0068] (2) In the pre-training and fine-tuning process, this invention uses cross-entropy loss and Dice loss to balance the accuracy and robustness of segmentation, so that the model can maintain good performance in different environments.

[0069] (3) In the post-processing process, the present invention employs techniques such as thresholding and morphological operations to extract noise and small areas, making the boundaries smoother and more continuous. Attached Figure Description

[0070] Figure 1 This is a schematic diagram of the overall process of the present invention.

[0071] Figure 2 This is a network structure diagram of the U-Segformer based on deep learning in this invention.

[0072] Figure 3 This is the overall architecture diagram of the Effi-Transformer module in this invention.

[0073] Figure 4 This is a flowchart illustrating the specific implementation of the self-attention mechanism in the overall architecture of the Effi-Transformer module in this invention.

[0074] Figure 5 This is a simplified structural diagram of the Patch Expanding module in this invention. Detailed Implementation

[0075] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments. The described embodiments are merely some embodiments of the present invention, and not all embodiments. Various modifications and improvements made to the technical solutions of the present invention by those skilled in the art without departing from the design concept of the present invention should fall within the protection scope of the present invention.

[0076] Example 1:

[0077] like Figure 1As shown, a deep learning-based U-SegFormer oil spill detection method includes the following steps:

[0078] Step 1: Data preparation: Use oil spill images acquired by remote sensing satellites as experimental data, and manually label the oil spill image data according to the oil spill level to create a dataset; divide the dataset into training set, validation set and test set according to a certain ratio to ensure that the training set, validation set and test set contain the same proportion of images of different oil spill levels to ensure the generalization ability of the model.

[0079] Step 2: Model Building: The network architecture of the U-Segformer model is as follows Figure 2 As shown, it can be divided into three main parts: encoder, bottleneck layer and decoder. The input image with size H×W×1 enters the encoder, where H represents the image height, W represents the image width, and 1 represents the number of image channels. The encoder processes the input image step by step through three stages and outputs three feature maps with different resolutions. The feature map with the lowest resolution enters the bottleneck layer. The bottleneck layer further extracts global features and outputs the processed feature map into the decoder. The decoder finally outputs the final segmentation result after three stages.

[0080] The specific implementation process of the U-SegFormer model is as follows:

[0081] Step 2.1: Input an image of size H×W×1. The image passes through three stages of the encoder. Each stage contains one OPM module and two Effi-Transformer modules. The overall architecture of the Effi-Transformer module is as follows: Figure 3 As shown; the main role of the OPM module in the U-Segformer model is to optimize the processing and merging of feature maps. By improving the expressive power of features and computational efficiency, it helps the model achieve better results in oil spill image segmentation tasks; the three stages will output feature maps X. s1 X s2 X s3 ,in

[0082] The specific implementation process of the Effi-Transformer module is as follows:

[0083] Step 2.1.1: Use an image of size H×W×1 as input to the Effi-Transformer module.

[0084] Step 2.1.2: Use the Self-Attention mechanism (Self-Attn) to process the input feature map and capture global information; the specific operation method is as follows:

[0085] Step 2.1.2.1: Input a feature map of size N×C, where N is the spatial size of the feature map, such as the number of pixels in the feature map; and C is the number of channels.

[0086] Step 2.1.2.2: The input feature map is transformed into query Q, key K and value V through three linear transformations.

[0087] ·Q=XW Q Generate a query matrix of size N×C.

[0088] ·K=XW K Generate a key matrix of size .

[0089] ·V=XW V Generate a value matrix of size .

[0090] Where X is the input feature map, W Q W K and W V It is the corresponding linear transformation matrix.

[0091] Step 2.1.2.3: Calculate the dot product of the query matrix and the key matrix, and perform scaling and softmax operations to obtain the attention weights:

[0092] Dot product: QK T The result size is

[0093] Scaling: Divide Where d i It is the dimension of the key matrix, usually equal to C.

[0094] Softmax: Apply the softmax function to the scaled result to obtain the attention weight matrix, which has a size of [value missing].

[0095] Step 2.1.2.4: Weighted Summation: Multiply the attention weight matrix by the value matrix V to obtain the weighted sum.

[0096] · The result size is N×C.

[0097] Step 2.1.3: The output of the self-attention mechanism is further processed through a hybrid feedforward network (Mix-FFN); such as... Figure 4 As shown, the specific steps for further processing are as follows:

[0098] Step 2.1.3.1: The feature map processed by the self-attention mechanism is first processed and transformed by a multilayer perceptron (MLP) layer.

[0099] Step 2.1.3.2: The feature map output by the MLP is passed through a 3×3 convolutional layer to capture local spatial features.

[0100] Step 2.1.3.3: The output of the convolutional layer is transformed by a GELU activation function.

[0101] Step 2.1.3.4: After convolution and activation functions, further feature processing and transformation are performed through another MLP layer.

[0102] Step 2.1.4: The final output feature map is used for subsequent processing.

[0103] Step 2.2: Feature Map The feature map is fed into the bottleneck layer via an OPM module, where an Effi-Transformer module processes the lowest-resolution features and outputs a feature map.

[0104] Step 2.3: The output of the bottleneck layer increases the resolution of the feature map through Patch Expanding. The feature map is processed by two Effi-Transformer modules and combined with... The skip chain connection features, the output feature size is X r3 The resolution of the feature map is further increased through Patch Expanding. The features are processed by two Effi-Transformer modules and combined with... The skip connection features, the output feature size of this stage is X r2 The resolution of the feature map is further increased through Patch Expanding. The features are processed by two Effi-Transformer modules and combined with... The skip chain connection features, the output feature size of this stage is X r1 By using Patch Expanding, the feature map is restored to the resolution of the original input image, and the output feature size is H×W×C0`.

[0105] The simplified structure of the Patch Expanding module is as follows: Figure 5 As shown, the specific implementation process of the Patch Expanding module is as follows:

[0106] Step 2.3.1: Input a concatenated feature map, with a size of [size missing].

[0107] Step 2.3.2: Reduce the number of channels in the input feature map from 4C to C using a linear transformation to obtain the fused feature map, with a size of...

[0108] Step 2.3.3: Perform another linear transformation on the fused feature map, increasing the number of channels from C to 2C, and the size of the feature map is...

[0109] Step 2.3.4: Reshape the feature map as follows Increase spatial resolution.

[0110] Step 2.3.5: Finally, a linear transformation is used to convert the number of channels in the feature map from C / 2 to N. C This generates the final output mask, with a size of H×W×N. C .

[0111] Step 3: Model Training: The U-SegFormer model is pre-trained and fine-tuned using the training and validation sets of the public dataset and the oil spill image dataset from Step 1 to obtain the segmentation model Y. The specific operation method is as follows:

[0112] Step 3.1: Data preprocessing: Preprocess the data, including normalization, image resizing, and data augmentation.

[0113] Step 3.2: Model Training: Define the learning rate, loss function, and training parameters; the specific operation method is as follows:

[0114] Loss function definition: For the U-SegFormer model, cross-entropy loss and Dice loss are combined to improve segmentation performance; the specific formula is as follows:

[0115] The formula for the Cross-Entropy Loss function is:

[0116]

[0117] In the above formula, y i The label is the actual label; if pixel i belongs to this category, then y... i =1, otherwise y i =0; p i This represents the probability that the model predicts pixel i belongs to a certain category.

[0118] The formula for the Dice loss function, Dice Loss, is:

[0119]

[0120] In the above formula, X and Y represent the predicted segmentation result and the true segmentation label, respectively, and X∩Y| represents the number of intersection pixels between the segmented image predicted by the model and the true image.

[0121] Combining the cross-entropy loss function and the Dice loss function yields the loss function used for training:

[0122] L Total =α×L Diceloss +β×L Celoss

[0123] In the above formula, L Total This represents the value of the total loss function, where α and β are weighting coefficients used to balance the two types of loss.

[0124] Step 3.3: Input a batch of training data in each training round, calculate the loss, and update the model parameters according to the loss gradient; use the validation set to evaluate the model performance and adjust the hyperparameters to optimize the model.

[0125] Step 3.4: Further fine-tune the U-SegFormer model using the training and validation sets of the self-made oil spill image dataset. In each training round, input a batch of self-made training data, calculate the loss, and update the model parameters according to the loss gradient. Use the validation set of the self-made dataset to validate and evaluate the model's performance in oil spill image segmentation.

[0126] Step 4: Post-segmentation processing. The model is tested using the test set of the oil spill image dataset from Step 1 to obtain the initial segmentation result. Then, post-processing is performed to obtain the final segmentation result. The specific implementation process for post-processing the initial segmentation model is as follows:

[0127] Step 4.1: Thresholding: Convert the probability map output by the model into a binary mask map; typically, by setting a threshold, if the predicted probability is greater than the threshold, it is determined to be the target area, otherwise it is the background;

[0128] Step 4.2: Morphological operations: Apply morphological operations such as dilation and erosion to remove noise and smooth segmentation boundaries;

[0129] Step 4.3: Edge Detection and Refinement: Use edge detection algorithms to further refine edge segmentation;

[0130] Step 4.4: Combine the results from multiple post-processing steps and apply a smoothing algorithm to smooth the final segmentation boundaries.

[0131] The above embodiments are only for illustrating the technical concept and features of the present invention, and are intended to enable those skilled in the art to understand the content of the present invention and implement it accordingly. They should not be construed as limiting the scope of protection of the present invention. All equivalent changes or modifications made in accordance with the spirit and essence of the present invention should be covered by the present invention.

Claims

1. A U-SegFormer oil spill detection method based on deep learning, characterized in that: Including the following steps: Step 1: Data preparation: Use oil spill images acquired by remote sensing satellites as experimental data, and manually label the oil spill image data according to the oil spill level to create a dataset; divide the dataset into training set, validation set and test set according to a certain ratio to ensure that the training set, validation set and test set contain the same proportion of images of different oil spill levels to ensure the generalization ability of the model. Step 2: Model Building: The network architecture of the U-Segformer model can be divided into three main parts: encoder, bottleneck layer, and decoder; the input size is... The image enters the encoder. Indicates the image height. Indicates the image width. This represents the number of image channels. The encoder processes the input image through three stages and outputs three feature maps with different resolutions. The feature map with the lowest resolution enters the bottleneck layer, which further extracts global features. The processed feature map is then output to the decoder, which, after three stages, finally outputs the final segmentation result. The specific implementation process of the U-SegFormer model is as follows: Step 2.1: Input size is The image is processed through three stages of the encoder. Each stage contains one OPM module and two Effi-Transformer modules. The main role of the OPM module in the U-Segformer model is to optimize the processing and merging of feature maps. By improving the expressive power of features and computational efficiency, it helps the model achieve better results in oil spill image segmentation tasks. The three stages output feature maps. , , ,in , , ; Step 2.2: Feature Map The feature map is fed into the bottleneck layer via an OPM module, where an Effi-Transformer module processes the lowest-resolution features and outputs a feature map. ; Step 2.3: The output of the bottleneck layer is used to increase the resolution of the feature map through Patch Expanding. The feature map is processed by two Effi-Transformer modules and combined with... The skip chain connection features, the output feature size is ; The resolution of the feature map is further increased through Patch Expanding. The features are processed by two Effi-Transformer modules and combined with... The skip connection features, the output feature size of this stage is ; The resolution of the feature map is further increased through Patch Expanding. The features are processed by two Effi-Transformer modules and combined with... The skip chain connection features, the output feature size of this stage is ; By employing patch expanding, the feature map is restored to the resolution of the original input image, and the output feature size is [value missing]. ; Step 3: Training the model: Use the training and validation sets of the public dataset and the oil spill image dataset from Step 1 to pre-train and fine-tune the U-SegFormer model to obtain the segmentation model Y; Step 4: Post-segmentation processing. Use the test set of the oil spill image dataset from Step 1 to test the model and obtain the initial segmentation results. Then perform post-processing to obtain the final segmentation results.

2. The U-SegFormer oil spill detection method based on deep learning according to claim 1, characterized in that: The specific implementation process of the Effi-Transformer module mentioned in step 2.1 is as follows: Step 2.1.1: [The text appears to be incomplete and contains several typos. A more accurate translation would require The image is used as input to the Effi-Transformer module; Step 2.1.2: Use the self-attention mechanism Self-Attention (SAATN) to process the input feature map and capture global information; Step 2.1.3: The output of the self-attention mechanism is further processed through a hybrid feedforward network Mix-FFN; Step 2.1.4: The final output feature map is used for subsequent processing.

3. The U-SegFormer oil spill detection method based on deep learning according to claim 2, characterized in that: The specific operation method of step 2.1.2 is as follows: Step 2.1.2.1: Input size is The feature map, where It is the spatial size of the feature map, such as the number of pixels in the feature map; It is the number of channels; Step 2.1.2.2: The input feature map is transformed into query Q, key K, and value V through three linear transformations: Q = XW Q Generate a query matrix of size . ; K = XW K Generate a key matrix of size . ; V = XW V Generate a value matrix of size . ; Where X is the input feature map. , and It is the corresponding linear transformation matrix; Step 2.1.2.3: Calculate the dot product of the query matrix and the key matrix, and perform scaling and softmax operations to obtain the attention weights: Dot product: The result size is ; Scaling: Divide ,in It is the dimension of the key matrix, usually equal to C; Softmax: Apply the softmax function to the scaled result to obtain the attention weight matrix, which has a size of [value missing]. ; Step 2.1.2.4: Weighted Summation: Multiply the attention weight matrix by the value matrix V to obtain the weighted sum. The result size is .

4. The U-SegFormer oil spill detection method based on deep learning according to claim 2, characterized in that: The specific operation method of step 2.1.3 is as follows: Step 2.1.3.1: The feature map processed by the self-attention mechanism is first processed and transformed by a multilayer perceptron (MLP) layer; Step 2.1.3.2: The feature map output by the MLP is passed through a 3×3 convolutional layer to capture local spatial features; Step 2.1.3.3: The output of the convolutional layer is transformed using a GELU activation function; Step 2.1.3.4: After convolution and activation functions, further feature processing and transformation are performed through another MLP layer.

5. The U-SegFormer oil spill detection method based on deep learning according to claim 1, characterized in that: The specific implementation process of the Patch Expanding module mentioned in step 2.3 is as follows: Step 2.3.1: Input a concatenated feature map, with a size of ; Step 2.3.2: Reduce the number of channels in the input feature map from 4C to C using a linear transformation to obtain the fused feature map, with a size of... ; Step 2.3.3: Perform another linear transformation on the fused feature map, increasing the number of channels from C to 2C, and the size of the feature map is... ; Step 2.3.4: Reshape the feature map to Increase spatial resolution; Step 2.3.5: Finally, a linear transformation is used to convert the number of channels in the feature map from C / 2 to... Generate the final output mask, with a size of .

6. The U-SegFormer oil spill detection method based on deep learning according to claim 1, characterized in that: The specific operation method for step 3 is as follows: Step 3.1: Data Preprocessing: Preprocess the data, including normalization, image resizing, and data augmentation; Step 3.2: Model Training: Define the learning rate, loss function, and training parameters; Step 3.3: Input a batch of training data in each training round, calculate the loss, and update the model parameters according to the loss gradient; evaluate the model performance using the validation set and adjust the hyperparameters to optimize the model; Step 3.4: Further fine-tune the U-SegFormer model using the training and validation sets of the self-made oil spill image dataset. In each training round, input a batch of self-made training data, calculate the loss, and update the model parameters according to the loss gradient. Use the validation set of the self-made dataset to validate and evaluate the model's performance in oil spill image segmentation.

7. The U-SegFormer oil spill detection method based on deep learning according to claim 6, characterized in that: The specific operation method for step 3.2 is as follows: Loss function definition: For the U-SegFormer model, cross-entropy loss and Dice loss are combined to improve segmentation performance; the specific formula is as follows: The formula for the Cross-Entropy Loss function is: ; In the above formula, This is the actual label; if pixel i belongs to this category, then... =1, otherwise =0; This represents the probability that the model predicts pixel i belongs to a certain category; The formula for the Dice loss function, Dice Loss, is: ; In the above formula, X and Y represent the predicted segmentation result and the true segmentation label, respectively. This represents the number of pixels that intersect between the segmented image predicted by the model and the real image. Combining the cross-entropy loss function and the Dice loss function yields the loss function used for training: ; In the above formula, This represents the value of the total loss function. and It is a weighting coefficient used to balance the two types of loss.

8. The U-SegFormer oil spill detection method based on deep learning according to claim 1, characterized in that: The specific implementation process of post-processing the initial segmentation model described in step 4 is as follows: Step 4.1: Thresholding: Convert the probability map output by the model into a binary mask map; typically, by setting a threshold, if the predicted probability is greater than the threshold, it is determined to be the target area, otherwise it is the background; Step 4.2: Morphological operations: Apply morphological operations such as dilation and erosion to remove noise and smooth segmentation boundaries; Step 4.3: Edge Detection and Refinement: Use edge detection algorithms to further refine edge segmentation; Step 4.4: Combine the results from multiple post-processing steps and apply a smoothing algorithm to smooth the final segmentation boundaries.

Citation Information

Patent Citations

  • Unsupervised cross-domain self-adaptive medical image segmentation method based on deep adversarial learning

    AU2020103905A4

  • Construction method of landscape painting semantic segmentation model

    CN117152750A