U-SegFormer petroleum oil spill detection method based on deep learning

By designing the U-SegFormer model and combining it with the Effi-Transformer and Patch Expanding modules, the problems of cumbersome and complex calculations in traditional oil spill detection methods are solved, efficient and precise oil spill detection is achieved, and the segmentation accuracy and pan-scalability of the model are improved. ization ability.

CN118823596AActive Publication Date: 2024-10-22HUAIYIN INSTITUTE OF TECHNOLOGY
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Traditional oil spill detection methods are cumbersome, time-consuming and costly, and image segmentation methods based on deep learning perform poorly when dealing with complex backgrounds and changing environments. The Transformer model has high computational complexity and is difficult to be directly applied to high resolutions. Processing of remote sensing images.

Method used

A U-SegFormer oil spill detection method based on deep learning is designed. By building a U-Segformer model, combining the feature extraction capabilities of Segformer and the symmetric encoder-decoder structure of U-Net, the Effi-Transformer module and Patch are introduced. The Expanding module optimizes feature extraction and expression capabilities, improves the model's sensitivity to details and boundaries, and uses cross-entropy loss and Dice loss to balance the accuracy and robustness of segmentation.

Benefits of technology

The model training speed and segmentation accuracy are improved, and the generated segmentation results are more refined and continuous, which can effectively handle complex oil spill detection tasks and improve the model's generalization ability and performance in different environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118823596A_ABST
    Figure CN118823596A_ABST
Patent Text Reader

Abstract

A U-SegFormer oil spill detection method based on deep learning comprises the following steps: step 1, data preparation: using an oil spill image collected by a remote sensing satellite as experimental data, and manually marking the oil spill image data according to the oil spill level; making a data set, and dividing the data set into a training set, a verification set and a test set according to a certain proportion; 2, building a model, wherein the network architecture of the U-Segform model can be divided into three main parts, namely an encoder, a bottleneck layer and a decoder; 3, training a model: pre-training and finely adjusting the U-SegFormer model by using a public data set and a training set and a verification set of the oil spill image data set in the step 1 to obtain a segmentation model Y; and step 4, segmentation post-processing: using the test set test model of the oil spill image data set in the step 1 to obtain an initial segmentation result, and then performing post-processing to obtain a final segmentation result. According to the method, high-resolution spatial information can be effectively reserved and utilized, and details can be better reserved and segmented.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of deep learning, and in particular relates to a U-SegFormer oil spill detection method based on deep learning. Background Art

[0002] Oil spills are a serious environmental pollution incident that usually occurs during oil transportation, drilling and production. Once an oil spill occurs, the oil will spread rapidly, polluting the marine and coastal ecosystems, seriously affecting the living environment of marine organisms, and even causing great damage to human health and economic activities. Therefore, it is very necessary to detect and monitor oil spills in a timely and accurate manner. Traditional oil spill detection methods mainly rely on on-site sampling and laboratory analysis, which are accurate but cumbersome, time-consuming and costly. In addition, remote sensing technology and radar technology are also widely used in the detection and monitoring of oil spills, but these methods still have certain limitations in terms of resolution and accuracy.

[0003] With the rapid development of deep learning technology, especially the widespread application of convolutional neural networks (CNN) and Transformer in the field of computer vision, image segmentation methods based on deep learning have shown great potential in oil spill detection. However, traditional image segmentation methods perform poorly when dealing with complex backgrounds and changing environments. Although the Transformer model performs well in capturing global information, it has a high computational complexity and is difficult to directly apply to the processing of high-resolution remote sensing images. Summary of the invention

[0004] In view of the technical problems of poor application effect, high computational complexity, inaccurate or discontinuous segmentation results in the above fields, this technical solution provides a U-SegFormer oil spill detection method based on deep learning. The newly constructed model structure can effectively retain and utilize high-resolution spatial information, so that the model can better retain and segment details when dealing with complex oil spill detection tasks. It improves the model training speed and the model segmentation accuracy; it can effectively solve the above problems.

[0005] The present invention is achieved through the following technical solutions:

[0006] A U-SegFormer oil spill detection method based on deep learning, comprising the steps of:

[0007] Step 1: Data preparation: Use oil spill images collected by remote sensing satellites as experimental data, manually annotate the oil spill image data according to the oil spill level, and make a data set; divide the data set into training set, validation set and test set according to a certain ratio, and 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: Build the model: The network architecture of the U-Segformer model can be divided into three main parts: encoder, bottleneck layer, and decoder. The input image of 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 of different resolutions. The feature map with the lowest resolution enters the bottleneck layer, which further extracts global features. The processed feature map enters the decoder, which finally outputs the final segmentation result after three stages.

[0009] Step 3: Training model: Use the public dataset and the training set and validation set of the oil spill image dataset in 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 in step 1 to test the model, obtain the initial segmentation result, and then perform post-processing to obtain the final segmentation result.

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

[0012] Step 2.1: Input an image of size H×W×1, and pass through three stages of the encoder. Each stage contains an OPM module and two Effi-Transformer modules. The main function of the OPM module in the U-Segformer model is to optimize the processing and merging of feature maps, and to help the model achieve better results in the oil spill image segmentation task by improving the feature expression ability and computational efficiency. The three stages will output the feature map X s1 , X s2 , X s3 ,in

[0013]

[0014] Step 2.2: Feature Map Enter the bottleneck layer through an OPM module, process the lowest resolution features through an Effi-Transformer module in the bottleneck layer, and output the feature map

[0015] Step 2.3: The output of the bottleneck layer is expanded through Patch Expanding to enlarge the resolution of the feature map. The feature map is processed through two Effi-Transformer modules and combined with The skip chain connection features are connected, and the size of the output feature is X r3 The resolution of the feature map is further expanded by Patch Expanding, and the features are processed by two Effi-Transformer modules and combined with The jump connection feature of this stage has an output feature size of X r2 The resolution of the feature map is further expanded by Patch Expanding, and the features are processed by two Effi-Transformer modules and combined with The skip chain connection features of this stage have an output feature size of X r1 Through a Patch Expanding, the feature map is restored to the resolution of the original input image, and the output feature size is H×W×C 0 、.

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

[0017] Step 2.1.1: Take 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-Attn 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 mixed 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:

[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; 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 respectively through three linear transformations:

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

[0024] K = XW K : Generate a key matrix of size

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

[0026] Among them, X is the input feature map, W Q , W K and W V 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 resulting size is

[0029] Scaling: Divide by where d i is the dimension of the bond matrix, usually equal to C;

[0030] Softmax: Apply the softmax function to the scaled result to get the attention weight matrix, which is

[0031] Step 2.1.2.4: Weighted summation: Multiply the attention weight matrix with the value matrix V to get the weighted summation result:

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

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

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

[0035] Step 2.1.3.2: The feature map output by MLP passes 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 through a GELU activation function;

[0037] Step 2.1.3.4: After the convolution and activation function, another MLP layer is used for further feature processing and transformation.

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

[0039] Step 2.3.1: Input a concatenated feature map of size

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

[0041] Step 2.3.3: The fused feature map is transformed by another linear transformation, the number of channels increases from C to 2C, and the size of the feature map is

[0042] Step 2.3.4: Reshape the feature map into Increased spatial resolution;

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

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

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

[0046] Step 3.2: Model training: define learning rate and loss function 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; use the validation set to evaluate the model performance and adjust the hyperparameters to optimize the model;

[0048] Step 3.4: Use the training set and validation set of the homemade oil spill image dataset to further fine-tune the U-SegFormer model. In each training round, input a batch of homemade training data, calculate the loss, and update the model parameters according to the loss gradient; use the validation set of the homemade dataset for verification and evaluate the performance of the model in oil spill image segmentation.

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

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

[0051] The formula of the cross-entropy loss function Cross-EntropyLoss is:

[0052]

[0053] In the above formula, y i is the true label. If pixel i belongs to this category, then y i =1, otherwise y i =0; p i Indicates the probability that the model predicts that pixel i belongs to a certain category;

[0054] The formula of Dice Loss function is:

[0055]

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

[0057] Combining the cross entropy loss function and the Dice loss function, we get the loss function for training:

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

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

[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. Usually, a threshold is set. If the predicted probability is greater than the threshold, it is judged as 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 correction: Use edge detection algorithm to further refine the segmentation edge;

[0064] Step 4.4: Merge 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 the present invention has the following beneficial effects compared with the prior art:

[0067] (1) The main feature of U-Segformer in the present invention is to express the Segformer model in a U-shaped architecture by combining the feature extraction capability of Segformer and the symmetric encoder-decoder structure of U-Net. At the same time, the Effi-Transformer module is introduced in both the encoder and the decoder to further optimize the feature extraction and expression capabilities, improve the model's sensitivity to details and boundaries, and thus improve the segmentation accuracy. In addition, the jump connection ensures the use of high-resolution features in the decoding process, making the segmentation results more refined.

[0068] (2) During the pre-training and fine-tuning process, the present invention uses a combination of 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) The present invention adopts thresholding processing and morphological operation techniques in the post-processing process, which makes the boundary smoother and more continuous while removing noise and small areas. BRIEF DESCRIPTION OF THE DRAWINGS

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

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

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

[0073] Figure 4 It is a specific implementation flow chart of the self-attention mechanism in the overall architecture of the Effi-Transformer module in the present invention.

[0074] Figure 5 It is a simplified structural diagram of the Patch Expanding module in the present invention. DETAILED DESCRIPTION

[0075] The following will be combined with the accompanying drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. The described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Under the premise of not departing from the design concept of the present invention, various modifications and improvements made by ordinary persons in the art to the technical solutions of the present invention should all fall within the protection scope of the present invention.

[0076] Embodiment 1:

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

[0078] Step 1: Data preparation: Use oil spill images collected by remote sensing satellites as experimental data, manually annotate the oil spill image data according to the oil spill level, and make a data set; divide the data set into training set, validation set and test set according to a certain ratio, and 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: Build the model: The network architecture of the U-Segformer model is as follows Figure 2 As shown in the figure, it can be divided into three main parts: encoder, bottleneck layer and decoder; the input image of size H×W×1 enters the encoder, H represents the image height, W represents the image width, and 1 represents the number of image channels; the encoder gradually processes the input image through three stages and outputs three feature maps of different resolutions. The feature map with the lowest resolution enters the bottleneck layer, and the bottleneck layer further extracts global features. The processed feature map enters the decoder. After three stages, the decoder finally outputs the final segmentation result.

[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 and pass it through three stages of the encoder. Each stage contains an OPM module and two Effi-Transformer modules. The overall architecture of the Effi-Transformer module is as follows: Figure 3 As shown in the figure, the main function of the OPM module in the U-Segformer model is to optimize the processing and merging of feature maps, and to help the model achieve better results in the oil spill image segmentation task by improving the feature expression ability and computational efficiency. 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: Take 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:

[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; 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 respectively 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] Among them, X is the input feature map, W Q , W K and W V 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 resulting size is

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

[0094] Softmax: Apply the softmax function to the scaled result to get the attention weight matrix, which is

[0095] Step 2.1.2.4: Weighted summation: Multiply the attention weight matrix with the value matrix V to get the weighted summation result:

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

[0097] Step 2.1.3: The output of the self-attention mechanism is further processed by a mixed feed-forward network Mix-FFN; Figure 4 As shown, the specific operation method for further processing is:

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

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

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

[0101] Step 2.1.3.4: After the convolution and activation function, another MLP layer is used for further feature processing and transformation.

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

[0103] Step 2.2: Feature Map Enter the bottleneck layer through an OPM module, process the lowest resolution features through an Effi-Transformer module in the bottleneck layer, and output the feature map

[0104] Step 2.3: The output of the bottleneck layer is expanded through Patch Expanding to enlarge the resolution of the feature map. The feature map is processed through two Effi-Transformer modules and combined with The skip chain connection features are connected, and the size of the output feature is X r3 The resolution of the feature map is further expanded by Patch Expanding, and the features are processed by two Effi-Transformer modules and combined with The jump connection feature of this stage has an output feature size of X r2 The resolution of the feature map is further expanded by Patch Expanding, and the features are processed by two Effi-Transformer modules and combined with The skip chain connection features of this stage have an output feature size of X r1 Through a Patch Expanding, the feature map is restored to the resolution of the original input image, and the output feature size is H×W×C 0 `.

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

[0106] Step 2.3.1: Input a concatenated feature map of size

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

[0108] Step 2.3.3: The fused feature map is transformed by another linear transformation, the number of channels increases from C to 2C, and the size of the feature map is

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

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

[0111] Step 3: Training model: Use the public dataset and the training set and validation set of the oil spill image dataset in step 1 to pre-train and fine-tune the U-SegFormer model to obtain the segmentation model Y. The specific operation 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 and loss function training parameters; the specific operation method is:

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

[0115] The formula of the cross-entropy loss function Cross-EntropyLoss is:

[0116]

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

[0118] The formula of Dice Loss function 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 segmentation image predicted by the model and the true image.

[0121] Combining the cross entropy loss function and the Dice loss function, we get the loss function for training:

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

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

[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: Use the training set and validation set of the homemade oil spill image dataset to further fine-tune the U-SegFormer model. In each training round, input a batch of homemade training data, calculate the loss, and update the model parameters according to the loss gradient; use the validation set of the homemade dataset for verification and evaluate the performance of the model in oil spill image segmentation.

[0126] Step 4: Post-segmentation processing: Use the test set of the oil spill image dataset in step 1 to test the model, obtain the initial segmentation result, and then perform post-processing to obtain the final segmentation result; the specific implementation process of 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. Usually, a threshold is set. If the predicted probability is greater than the threshold, it is judged as 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 correction: Use edge detection algorithm to further refine the segmentation edge;

[0130] Step 4.4: Merge 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 their purpose is to enable people familiar with the technology to understand the content of the present invention and implement it accordingly, and they cannot be used to limit the protection scope of the present invention. Any equivalent transformation or modification made according to the spirit of the present invention should be included in the present invention.

Claims

1. A U-SegFormer oil spill detection method based on deep learning, characterized by: Includes steps: Step 1: Data preparation: Use oil spill images collected by remote sensing satellites as experimental data, manually annotate the oil spill image data according to the oil spill level, and make a data set; divide the data set into training set, validation set and test set according to a certain ratio, and 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: Build the model: The network architecture of the U-Segformer model can be divided into three main parts: encoder, bottleneck layer, and decoder. The input image of 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 of different resolutions. The feature map with the lowest resolution enters the bottleneck layer, which further extracts global features. The processed feature map enters the decoder, which finally outputs the final segmentation result after three stages. Step 3: Training model: Use the public dataset and the training set and validation set of the oil spill image dataset in 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 in step 1 to test the model to obtain the initial segmentation result, and then perform post-processing to obtain the final segmentation result.

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 U-SegFormer model in step 2 is as follows: Step 2.1: Input an image of size H×W×1, and pass through three stages of the encoder. Each stage contains an OPM module and two Effi-Transformer modules. The main function of the OPM module in the U-Segformer model is to optimize the processing and merging of feature maps, and to help the model achieve better results in the oil spill image segmentation task by improving the feature expression ability and computational efficiency. The three stages will output the feature map X s1 , X s2 , X s3 ,in Step 2.2: Feature Map Enter the bottleneck layer through an OPM module, process the lowest resolution features through an Effi-Transformer module in the bottleneck layer, and output the feature map Step 2.3: The output of the bottleneck layer is expanded through Patch Expanding to enlarge the resolution of the feature map. The feature map is processed through two Effi-Transformer modules and combined with The skip chain connection features are connected, and the size of the output feature is X r3 The resolution of the feature map is further expanded by Patch Expanding, and the features are processed by two Effi-Transformer modules and combined with The jump connection feature of this stage has an output feature size of X r2 The resolution of the feature map is further expanded by Patch Expanding, and the features are processed by two Effi-Transformer modules and combined with The skip chain connection features of this stage have an output feature size of X r1 Through a Patch Expanding, the feature map is restored to the resolution of the original input image, and the output feature size is H×W×C0.

3. The U-SegFormer oil spill detection method based on deep learning according to claim 2, characterized in that: The specific implementation process of the Effi-Transformer module described in step 2.1 is as follows: Step 2.1.1: Take an image of size H×W×1 as input to the Effi-Transformer module; Step 2.1.2: Use the self-attention mechanism Self-Attn 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 mixed feedforward network Mix-FFN; Step 2.1.4: The final output feature map is used for subsequent processing.

4. The U-SegFormer oil spill detection method based on deep learning according to claim 3, characterized in that: The specific operation method of step 2.1.2 is: 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; C is the number of channels; Step 2.1.2.2: The input feature map is transformed into query Q, key K and value V respectively through three linear transformations: Q = XW Q : Generate a query matrix of size N×C; K = XW K : Generate a key matrix of size V = XW V : Generate a value matrix of size Among them, X is the input feature map, W Q , W K and W V 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: QK T , the resulting size is Scaling: Divide by where d i is the dimension of the bond matrix, usually equal to C; Softmax: Apply the softmax function to the scaled result to get the attention weight matrix, which is Step 2.1.2.4: Weighted summation: Multiply the attention weight matrix with the value matrix V to get the weighted summation result: · The resulting size is N×C.

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

6. The U-SegFormer oil spill detection method based on deep learning according to claim 2, characterized in that: The specific implementation process of the Patch Expanding module described in step 2.3 is as follows: Step 2.3.1: Input a concatenated feature map of size Step 2.3.2: Reduce the number of channels of the input feature map from 4C to C through a linear transformation to obtain a fused feature map of size Step 2.3.3: The fused feature map is transformed by another linear transformation, the number of channels increases from C to 2C, and the size of the feature map is Step 2.3.4: Reshape the feature map into Increased spatial resolution; Step 2.3.5: Finally, a linear transformation is performed to convert the number of channels of the feature map from C / 2 to N. C , generating the final output mask, size H×W×N C .

7. The U-SegFormer oil spill detection method based on deep learning according to claim 1, characterized in that: The specific operation method of step 3 is: Step 3.1: Data preprocessing: Preprocess the data, including normalization, image resizing, and data enhancement; Step 3.2: Model training: define learning rate and loss function 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; use the validation set to evaluate the model performance and adjust the hyperparameters to optimize the model; Step 3.4: Use the training set and validation set of the homemade oil spill image dataset to further fine-tune the U-SegFormer model. In each training round, input a batch of homemade training data, calculate the loss, and update the model parameters according to the loss gradient; use the validation set of the homemade dataset for verification and evaluate the performance of the model in oil spill image segmentation.

8. The U-SegFormer oil spill detection method based on deep learning according to claim 7, characterized in that: The specific operation method of step 3.2 is: Define the loss function: For the U-SegFormer model, combine cross entropy loss and Dice loss to improve segmentation performance; the specific formula is as follows: The formula of the cross-entropy loss function Cross-EntropyLoss is: In the above formula, y i is the true label. If pixel i belongs to this category, then y i =1, otherwise y i =0; p i Indicates the probability that the model predicts that pixel i belongs to a certain category; The formula of Dice Loss function is: In the above formula, X and Y represent the predicted segmentation result and the real segmentation label respectively, and |X∩Y| represents the number of intersection pixels between the segmentation image predicted by the model and the real image; Combining the cross entropy loss function and the Dice loss function, we get the loss function for training: L Total =α×L Diceloss +β×L Celoss In the above formula, L Total represents the value of the total loss function, α and β are weight coefficients used to balance the two losses.

9. 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. Usually, a threshold is set. If the predicted probability is greater than the threshold, it is judged as 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 correction: Use edge detection algorithm to further refine the segmentation edge; Step 4.4: Merge the results from multiple post-processing steps and apply a smoothing algorithm to smooth the final segmentation boundaries.