Water surface oil spill lightweight semantic segmentation method, device and equipment based on improved U-Net
By improving the DSAN-Unet network model and combining Half-Conv, Ghost modules, and Lovász-Softmax Loss, the real-time performance and accuracy issues of semantic segmentation models on resource-constrained devices are resolved, enabling efficient monitoring of small oil spill areas in complex water environments.
Patent Information
- Application Number
- CN202610062360.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-17
- Publication Date
- 2026-04-14
AI Technical Summary
Existing semantic segmentation models struggle to achieve real-time inference on resource-constrained embedded devices, and their segmentation accuracy for small oil spill areas is insufficient in complex water surface environments, especially when there is an imbalance between the 'less oil and more water' categories, making them prone to missed detections.
An improved DSAN-Unet network model is adopted, which optimizes the feature extraction and classification process by introducing a Half-Conv module in the encoder and using a Ghost module in the decoder, combined with channel pruning strategy and Lovász-Softmax Loss, thereby achieving lightweight model and high-precision segmentation.
It enables real-time oil spill monitoring in complex water environments on embedded devices, significantly improving the segmentation accuracy and detection speed of small oil spill targets, and reducing the false alarm and missed detection rates.
Smart Images

Figure CN121861289A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a lightweight semantic segmentation method for oil spills on water surfaces based on an improved U-Net, belonging to the field of environmental monitoring and edge computing technology. Background Technology
[0002] Rivers are vital carriers of freshwater resources, and their ecological security directly impacts regional economic development and the quality of life for residents. However, with the rapid development of shipping and coastal industries, sudden oil spills caused by ship leaks and illegal industrial discharges occur frequently. Traditional oil spill monitoring on river surfaces relies mainly on manual inspections or fixed-point water quality sensors. The former is labor-intensive, has limited coverage, and poor real-time performance, while the latter can only detect specific locations and struggles to assess the spread and distribution of oil spills. Therefore, constructing an all-weather, wide-coverage automated visual monitoring system for oil spills has become an urgent need for water environment management.
[0003] With the rapid development of deep learning, semantic segmentation algorithms based on convolutional neural networks have become the mainstream technology in the field of image processing. Unlike object detection, which only outputs bounding boxes, semantic segmentation can accurately delineate the edges and shapes of objects by classifying each pixel in an image. Current semantic segmentation algorithms are mainly divided into two categories: one is heavyweight networks that pursue extreme accuracy, such as the DeepLab series and PSPNet, which expand the receptive field through dilated convolutions or pyramid pooling, but require enormous computation; the other is classic networks based on encoder-decoder structures, with representative methods being FCN and U-Net. The U-Net structure, due to its unique skip connection design, can effectively fuse deep semantic information with shallow spatial details, demonstrating excellent performance in segmentation tasks involving small targets, such as medical images. However, applying it to edge-side monitoring of oil spills on rivers still faces significant challenges: First, the river environment is extremely complex, severely affected by factors such as changes in lighting, water ripple disturbances, reflections, and floating debris, often resulting in images with low contrast and high noise. Second, oil spill monitoring scenarios exhibit extreme "less oil, more water" class imbalance characteristics, making small oil spill areas easily overlooked by loss functions dominated by background pixels, leading to missed detections. Finally, existing high-performance segmentation models, such as the original U-Net, have a large number of parameters and high computational complexity, making real-time inference difficult to achieve on resource-constrained embedded edge devices. While current mainstream lightweight models are faster, they often sacrifice segmentation accuracy for small, irregular oil spots when significantly compressing parameters. Therefore, developing a lightweight river oil spill monitoring model that can adapt to complex water environments and balance segmentation accuracy with inference speed has significant application value. Summary of the Invention
[0004] To address the problems of high computational complexity, difficulty in deployment on resource-constrained edge devices, and high miss rate of small targets due to category imbalance ("less oil, more water") in existing semantic segmentation models, this invention provides a lightweight semantic segmentation method for oil spills on water surfaces based on an improved U-Net. This method enables accurate and real-time segmentation of oil spill areas in complex water environments, providing technical support for automated early warning and intelligent management of inland water environments.
[0005] The technical solution of this invention is:
[0006] According to a first aspect of the present invention, a lightweight semantic segmentation method for oil spills on water surfaces based on an improved U-Net is provided, comprising:
[0007] Step 1: Obtain the oil spill image to be segmented on the water surface, adjusted to the preset size, and the trained DSAN-Unet network model; wherein, the trained DSAN-Unet network model includes an encoder and a decoder, and the two are connected by skip connections;
[0008] Step 2: Use the oil spill image to be segmented as input to the trained DSAN-Unet network model; the input image is pruned in the first channel to extract the initial feature map, and the initial feature map is sent to the four-stage encoder. Each encoding stage uses the improved DSAN module for local structure and texture information modeling, followed by downsampling; after encoding is completed, the feature stream is transferred to the decoder. The decoder uses a bottom-up, step-by-step feature recovery strategy based on the Ghost module and upsampling to fuse and reconstruct multi-scale features. The decoder output is pruned in the second channel to output pixel-level classification results with the same size as the input.
[0009] Furthermore, the first channel pruning operation specifically involves extracting an initial feature map with a resolution of 128×128 and a number of channels from the input image through a convolutional layer with a kernel size of 4×4 and a stride of 4.
[0010] Furthermore, the encoder of the DSAN-Unet network model is specifically as follows:
[0011] In the first encoding stage, the initial feature map is first modeled with local structure and texture information by two layers of improved DSAN module to obtain a first encoding stage feature map with a resolution of 128×128 and 32 channels. Then, it is downsampled by a 3×3 convolutional layer with a stride of 2, which halves the feature resolution to 64×64 and expands the number of channels to 64.
[0012] In the second encoding stage, the 64-channel features are further mined by the two-layer improved DSAN module to obtain the second encoding stage feature map with a resolution of 64×64 and a number of channels of 64. The feature resolution is halved to 32×32 and the number of channels is increased to 96 by the same downsampling operation as the first encoding stage.
[0013] In the third encoding stage, a 3-layer improved DSAN module is applied to the 96-channel features to enhance the high-level semantic expression capability, resulting in a third encoding stage feature map with a resolution of 32×32 and 96 channels. Subsequently, the feature resolution is compressed to 16×16 and the number of channels is expanded to 128 through the same downsampling operation as in the first encoding stage.
[0014] In the fourth encoding stage, a two-layer improved DSAN module is applied to the 128-channel features to further enhance the high-level semantic representation capability and stabilize the bottleneck feature representation, resulting in a fourth encoding stage feature map with a resolution of 16×16 and 128 channels.
[0015] Furthermore, the improved DSAN module uses the Half-Conv module as its basic building block. The Half-Conv module divides the input feature map into two along the channel dimension: the first half of the channels undergoes depthwise separable convolution, while the second half of the channels is directly mapped using an identity to preserve the original context information. The two results are then concatenated along the channel dimension for output. Subsequently, the output of the Half-Conv module is concatenated with the original input feature map of the improved DSAN module. The concatenated result is then processed by BN and MLP modules, and the output is concatenated with the original input feature map of the improved DSAN module to obtain the final output.
[0016] Furthermore, the decoder of the DSAN-Unet network model is specifically as follows:
[0017] In the first decoding stage, the 128-channel high-level features output from the encoder end are upsampled by 2 times and concatenated with the feature map of the third encoding stage with a resolution of 32×32 and 96 channels, so that the number of feature channels is expanded to 224. Then, the concatenated features are processed by two layers of Ghost modules in the first decoding stage to adjust the number of channels to 128, thereby realizing the fusion of high-level semantic information and low-level spatial details.
[0018] In the second decoding stage, the 128-channel features output from the first decoding stage are upsampled by 2 times and then concatenated with the second-stage encoder feature map with a resolution of 64×64 and a channel count of 64, increasing the number of feature channels to 192. Subsequently, the concatenated features are processed through two layers of Ghost modules in the second decoding stage to adjust the number of channels to 96, thereby achieving the fusion of mid-level semantic information and spatial details.
[0019] In the third decoding stage, the 96-channel features output from the second decoding stage are upsampled by 2 times and then concatenated with the first-stage encoder feature map, which has a resolution of 128×128 and 32 channels, to expand the number of feature channels to 128. The concatenated features are then processed by two layers of Ghost modules in the third decoding stage to adjust the number of channels to 64, thereby achieving the fusion of low-level semantic information and high-level spatial details.
[0020] Furthermore, the second channel pruning operation is as follows: the feature map output by the decoder is classified and predicted by a convolutional layer with a kernel size of 1×1 and a stride of 2. Then, the prediction result is restored to the original size by 4 times upsampling, and the pixel-level classification result with the same input size is output.
[0021] Furthermore, the training process of the DSAN-Unet network model is as follows:
[0022] Acquire video data of oil spills on the water surface; based on the video data, use the method of "fixed interval frame extraction + quality verification" to filter image frames to construct a basic dataset; enhance the basic dataset to construct an oil spill image dataset; crop the images in the oil spill image dataset to a preset size and label them by outlining them pixel by pixel to obtain a labeled dataset; divide the labeled dataset into a training set and a validation set.
[0023] The DSAN-Unet network model was trained using the training and validation sets. During the training process, Lovász-Softmax Loss was used as the loss function for optimization to obtain the trained DSAN-Unet network model.
[0024] Furthermore, the method of "fixed interval frame extraction + quality verification" is used to filter image frames in order to construct a basic dataset. Specifically, candidate images are initially obtained from the video data by extracting one image at a frequency of one first preset number of frames; valid images are retained from the candidate images, and finally, a second preset number of oil spill images are selected as the basic dataset.
[0025] According to a second aspect of the present invention, a lightweight semantic segmentation apparatus for water surface oil spills based on an improved U-Net is provided, comprising a module of the lightweight semantic segmentation method for water surface oil spills based on any one of the above-described improved U-Net methods.
[0026] According to a third aspect of the present invention, an edge device is provided, including a memory, a processor, and a computer program stored in the memory, the processor executing the computer program to implement the steps of the lightweight semantic segmentation method for water surface oil spills based on any of the above-described improved U-Net.
[0027] The beneficial effects of this invention are:
[0028] 1. This invention introduces an integrated Half-Conv module to improve the DSAN module in the encoder. By performing convolution operations only on a portion of the channels, it significantly reduces computational redundancy and memory access overhead during feature extraction. At the same time, it combines an MLP structure to improve the DSAN module, effectively enhancing the abstraction capability of multi-scale spatial semantic features while maintaining the model's lightweight nature.
[0029] 2. This invention replaces the traditional standard convolutional unit with the Ghost module in the decoder path, and uses inexpensive linear operations to generate feature maps. This effectively solves the problem of excessive parameters and "top-heavy" computational load in the traditional U-Net architecture during the feature reconstruction stage. While ensuring the richness of feature maps, it achieves a cliff-like decrease in the number of model parameters and computational load.
[0030] 3. This invention implements a channel pruning strategy combined with a skip connection mechanism. By eliminating redundant channels in the feature extraction process, the model is compressed into a "narrow body" structure (maximum number of channels is only 128), which greatly reduces the model size. At the same time, skip connections are used to introduce shallow details of the encoder into the decoder, which makes up for the spatial information loss that may be caused by pruning and downsampling, and ensures the precision of the segmentation edges.
[0031] 4. This invention introduces Lovász-Softmax Loss to replace the traditional cross-entropy loss function, directly optimizing the core metric (IoU) of semantic segmentation, effectively solving the extreme "less oil, more water" category imbalance problem in inland river oil spill monitoring; this improvement significantly enhances the model's segmentation accuracy for small oil spill targets and complex oil-water boundaries, reducing the false alarm rate and false positive rate.
[0032] 5. The model constructed in this invention achieves an extreme balance between lightweight design and high precision, with a final model parameter count of only 0.81M. On an embedded edge device, the NVIDIA Jetson Orin NX, the inference speed reaches 47.44 FPS. This allows the system to be directly deployed on resource-constrained river surface monitoring terminals, meeting the requirements for low-latency real-time online monitoring and possessing extremely high engineering application value. Attached Figure Description
[0033] Figure 1 This is a diagram of the DSAN-Unet network structure designed according to an embodiment of the present invention.
[0034] Figure 2 This is a simulated internal river scene diagram of the present invention.
[0035] Figure 3This is the Half-Conv structure of the present invention.
[0036] Figure 4 This is a schematic diagram of the MLP structure of the present invention.
[0037] Figure 5 This is a schematic diagram of the improved DSAN module structure of the present invention.
[0038] Figure 6 This is a schematic diagram of the Ghost module structure of the present invention.
[0039] Figure 7 The image shows a comparison of the original data of the water spill dataset, the detection results of other detection methods, and the DSAN-Unet network model of this invention. Detailed Implementation
[0040] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention. It should be noted that, unless otherwise specified, the embodiments and features in the embodiments of this application can be arbitrarily combined with each other.
[0041] Example 1: As Figures 1-7 As shown, according to a first aspect of the present invention, a lightweight semantic segmentation method for oil spills on water surfaces based on an improved U-Net is provided, comprising:
[0042] Step 1: Obtain the oil spill image to be segmented on the water surface, adjusted to the preset size, and the trained DSAN-Unet network model; wherein, the trained DSAN-Unet network model includes an encoder and a decoder, and the two are connected by skip connections;
[0043] Step 2: Use the oil spill image to be segmented as input to the trained DSAN-Unet network model; the first channel pruning operation of the input image extracts the initial feature map, and the initial feature map is sent to the four-stage encoder. Each encoding stage uses the improved DSAN module for local structure and texture information modeling, followed by downsampling operation; after the encoding is completed, the feature stream is transferred to the decoder. The decoder uses a bottom-up, step-by-step feature recovery strategy based on the Ghost module and upsampling operation to fuse and reconstruct multi-scale features. The decoder output is pruned in the second channel to output pixel-level classification results with the same size as the input.
[0044] It should be noted that the DSAN-Unet network model is an improvement upon the U-Net baseline model. The standard U-Net network architecture comprises three core components: a shrinking path (encoder), an expanding path (decoder), and skip connections. Specifically, the shrinking path extracts features from the input image level by level using a series of operations such as convolution and pooling, thereby generating a set of multi-scale feature maps with decreasing size. The expanding path gradually restores the feature map size through upsampling operations and simultaneously concatenates and fuses it with the feature maps of the same scale from the shrinking path. Skip connections are responsible for passing the detailed features of each level in the shrinking path to the expanding path, thereby compensating for feature loss during the upsampling process and enhancing the model's ability to capture target details. Finally, the detection head module receives the feature map output from the expanding path and completes pixel-level classification prediction of the target region. The DSAN-Unet network model proposed in this invention is an improvement upon the U-Net baseline model, and its specific structure is as follows: Figure 1 As shown, this invention embeds an improved DSAN module as the backbone network in the shrinking path (encoder) of U-Net to replace the original standard convolutional module; at the same time, it replaces the standard convolutional module with a Ghost module in the expanding path (decoder); and further compresses the model size through a channel pruning strategy during training to adapt to the resource constraints of embedded devices.
[0045] Specifically, the DSAN-U-Net network starts with an input image of size 512×512. First, the input image undergoes a first-channel pruning operation, which extracts an initial feature map with a resolution of 128×128 and 32 channels through a convolutional layer with a kernel size of 4×4 and a stride of 4. This achieves both spatial dimensionality downsampling and channel expansion, mapping the original pixel information to a low-resolution, high-dimensional feature space, providing a unified feature representation basis for subsequent multi-stage feature extraction.
[0046] Furthermore, the encoder of the DSAN-Unet network model is specifically as follows:
[0047] In the first encoding stage, the initial feature map is first modeled with local structure and texture information by two layers of improved DSAN module to obtain a first encoding stage feature map with a resolution of 128×128 and 32 channels. Then, it is downsampled by a 3×3 convolutional layer with a stride of 2, which halves the feature resolution to 64×64 and expands the number of channels to 64.
[0048] In the second encoding stage, the 64-channel features are further mined by the two-layer improved DSAN module to obtain the second encoding stage feature map with a resolution of 64×64 and a number of channels of 64. The feature resolution is halved to 32×32 and the number of channels is increased to 96 by the same downsampling operation as the first encoding stage.
[0049] In the third encoding stage, a 3-layer improved DSAN module is applied to the 96-channel features to enhance the high-level semantic expression capability, resulting in a third encoding stage feature map with a resolution of 32×32 and 96 channels. Subsequently, the feature resolution is compressed to 16×16 and the number of channels is expanded to 128 through the same downsampling operation as in the first encoding stage.
[0050] In the fourth encoding stage, a two-layer improved DSAN module is applied to the 128-channel features to further enhance the high-level semantic representation capability and stabilize the bottleneck feature representation, resulting in a fourth encoding stage feature map with a resolution of 16×16 and 128 channels.
[0051] As can be seen from the above technical solution, through the four-stage downsampling and feature extraction process, the network realizes multi-scale feature representation from fine-grained texture information to high-level abstract semantics, providing high-level features with sufficient semantic information and compact structure for the subsequent decoding stage.
[0052] Furthermore, such as Figures 3-5 As shown, the improved DSAN module uses the Half-Conv module as its basic building block. The Half-Conv module divides the input feature map into two along the channel dimension: the first half of the channel performs depthwise separable convolution, and the Half-Conv module utilizes the Winograd underlying acceleration optimization adapted to the mainstream ARM architecture processors to extract spatial features; the second half of the channel directly uses identity mapping to preserve the original context information, and the two results are concatenated along the channel dimension for output; subsequently, the output of the Half-Conv module is concatenated with the original input feature map of the improved DSAN module, and the output of the concatenated result after passing through BN and MLP modules is concatenated with the original input feature map of the improved DSAN module as the output of the improved DSAN module. In the technical solution of this invention, in order to solve the problem of limited feature interaction caused by the Half-Conv module, BN is introduced after the output of the Half-Conv module for normalization, and then the MLP module is used to effectively perform deep fusion of the features of the depthwise separable convolution branch and the identity mapping branch of the Half-Conv module. This structure not only retains the advantage of low theoretical computational cost of Half-Conv, but also successfully compensates for the loss of feature interaction caused by local convolution by leveraging the powerful nonlinear fitting capability of MLP, thus achieving an excellent balance between efficiency and performance.
[0053] Furthermore, such as Figure 3As shown, addressing the pain points of computing resources and memory bandwidth on edge devices, the Half-Conv module abandons the paradigm of performing full computation on all input channels and adopts a "divide and conquer" strategy to process feature maps. First, the input feature map is divided into two parts along the channel dimension. A depthwise separable convolution operation is performed on the first half of the channels to extract spatial features. Second, an identity mapping is directly performed on the second half of the channels to preserve the original contextual information. Finally, the two results are concatenated along the channel dimension for output.
[0054] The core Half-Conv operation formula is expressed as follows:
[0055] ;
[0056] In the formula, the input data and output results of the Half-Conv module are defined as follows: , Where h, w, and c represent height, width, and number of channels, respectively. This represents the first half of the input feature map, used to perform a 3×3 depthwise separable convolution to extract spatial features; The latter half of the channel is represented by an identity mapping to preserve the original context information. Concat represents a concatenation operation along the channel dimension.
[0057] Meanwhile, the Half-Conv module offers significant advantages in terms of lightweight design and I / O optimization. This is because it only optimizes half of the channels (denoted as c). b The convolution operation is performed using c / 2, and the formulas for its floating-point operation complexity and video memory access complexity are as follows:
[0058] ;
[0059] ;
[0060] Where, k 2 Let k be the kernel size. In this calculation, the spatial resolution h×w of the feature map is much larger than the kernel size k. 2 The memory access cost due to the weight parameters is negligible. Compared to standard convolution, the Half-Conv module has only one-quarter of the FLOPs of regular convolution, reducing memory access cost by about half.
[0061] This invention addresses the I / O latency issue caused by the increased number of channels in traditional depthwise separable convolution by constructing a DSAN Block based on Half-Conv and embedding it into the feature extraction stages of the DSAN-Unet network encoder path. This design effectively overcomes the I / O bottleneck of edge devices while maintaining feature extraction capabilities, thus significantly improving the real-time inference speed and energy efficiency of the model in river oil spill detection tasks.
[0062] like Figure 4 As shown, the MLP module presents a typical three-layer concatenated structure of "point convolution-activation-point convolution," aiming to efficiently achieve information interaction and fusion between feature channels. The workflow follows a top-down data flow path: first, the input features are expanded to a higher-dimensional space through a top-level 1×1 convolutional layer to decouple and upgrade semantic features; then, a non-linear factor is introduced through an intermediate ReLU activation function layer, effectively enhancing the model's ability to capture complex feature relationships; finally, the features are projected back to the original channel dimension through a bottom-level 1×1 convolutional layer. In the improved DSAN module of this invention, the MLP module, acting as a channel mixer, works in conjunction with the Half-Conv module responsible for spatial extraction. Without changing the spatial resolution, it significantly improves the model's integration depth of multi-dimensional semantic information through weighted combination across channels.
[0063] like Figure 5 As shown, to address the computational complexity and high inference latency issues of the deformable strip convolution operator in the original DSAN network on embedded edge devices, this invention constructs a lightweight DSAN encoder as the U-Net backbone network. Specifically, this invention reconstructs the core components of the DSAN module, replacing the original dynamic deformation branch with a Half-Conv module. The core Half-Conv and MLP operation formulas are expressed as follows:
[0064] ;
[0065] ;
[0066] ;
[0067] Among them, input data , and These represent the feature subsets after channel splitting in the Half-Conv module. DWConv represents depthwise separable convolution, and Y is the concatenated intermediate feature (i.e., the output of the Half-Conv module). The final output Y1 is obtained by adding the features processed by the MLP and the original input features through residual connections. This residual design is not a simple feature superposition, but rather a complementary relationship between the features output by the MLP and the original input features. It preserves the basic information of the input features without damage and incorporates the high-level semantic features refined by the MLP. This feature combination of the original features and the features processed by the MLP can provide a smoother gradient propagation path during backpropagation, avoiding the gradient vanishing problem during deep network training. At the same time, it allows the module to maintain sufficient feature representation capabilities while being lightweight, effectively ensuring the training stability and feature learning efficiency of the network in deep iterations.
[0068] Furthermore, the decoder of the DSAN-Unet network model is specifically as follows:
[0069] In the first decoding stage, the 128-channel high-level features output from the encoder end are upsampled by 2 times and concatenated with the feature map of the third encoding stage with a resolution of 32×32 and 96 channels in the channel dimension, so that the number of feature channels is expanded to 224. Then, the concatenated features are processed by two layers of Ghost modules in the first decoding stage to adjust the number of channels to 128, reduce the computational complexity, and realize the fusion of high-level semantic information and low-level spatial details.
[0070] In the second decoding stage, the 128-channel features output from the first decoding stage are upsampled by 2 times and then concatenated with the second-stage encoder feature map with a resolution of 64×64 and a channel count of 64, increasing the number of feature channels to 192. Subsequently, the concatenated features are processed through two layers of Ghost modules in the second decoding stage to adjust the number of channels to 96, thereby achieving the fusion of mid-level semantic information and spatial details.
[0071] In the third decoding stage, the 96-channel features output from the second decoding stage are upsampled by a factor of 2 and then concatenated with the feature map of the first-stage encoder (corresponding resolution of 128×128 and 32 channels), expanding the feature channel count to 128. The concatenated features are then processed through two layers of Ghost modules in the third decoding stage to adjust the channel count to 64, achieving the fusion of low-level semantic information and high-level spatial details. Through the aforementioned stage-by-stage upsampling, feature concatenation, and Ghost module operations, the decoder achieves hierarchical fusion of multi-scale semantic information and spatial details.
[0072] Finally, the feature map output by the decoder is used for classification prediction through a convolutional layer with a kernel size of 1×1 and a stride of 2. Then, the prediction result is upsampled by 4 times to restore it to its original size, outputting a pixel-level classification result with the same input size, thus achieving accurate segmentation of the oil spill area. While ensuring detection accuracy, the overall network structure balances computational efficiency with the need for a lightweight model.
[0073] When the decoder restores the image to 1 / 4 resolution (64 channels) of the original image, classification prediction is performed through a 1×1 convolutional layer, followed by direct 4x bilinear upsampling.
[0074] It should be noted that, to avoid computational redundancy in the feature reconstruction stage of the traditional U-Net decoder and to prevent an unbalanced "top-heavy" architecture, this invention introduces a Ghost Module in the decoder section to replace the standard convolution. For example... Figure 6As shown, the specific working process of the Ghost module is as follows:
[0075] Based on the prior knowledge of high similarity between feature map channels, we first use standard convolution to compress and map half of the input features, extracting a basic intrinsic feature map rich in semantic information. Assume the input features are... This process can be represented as:
[0076] ;
[0077] Where * denotes a convolution operation. For the convolution kernel used, This generates m intrinsic feature maps. At this stage, the model can capture core semantic information using only half the normal computing power.
[0078] A series of low-cost linear operations are applied to each generated intrinsic feature map to generate extended "phantom features." The formula is as follows:
[0079] ;
[0080] in, yes The first in Each intrinsic feature map To generate the first A linear transformation function for each phantom feature map. Specifically, some... Defined as an identity mapping, it directly preserves the original intrinsic features.
[0081] Finally, the generated intrinsic feature map and phantom feature map are concatenated along the channel dimension to construct the final high-dimensional output feature map. Through a strategy that utilizes half the computational cost of standard convolution and employs inexpensive transformations, the decoder achieves a theoretical speedup of s times (the compression ratio is set to s=2 in this invention) while maintaining feature richness. This design enables DSAN-Unet to efficiently utilize the skip connection information transmitted by the encoder to achieve accurate restoration of edge details in oil spill areas on the river surface with minimal computational power.
[0082] As can be seen from the above technical solution, the DSAN-Unet network model of this invention, compared with U-Net, implements an 'encoder-decoder collaborative channel pruning' strategy, and performs a lightweight reconstruction of the overall model architecture from the encoder input end to the decoder output end: In the encoder part, the original DSAN's wide channel design (original configuration [64, 128, 320, 512]) which pursued large-scale feature extraction is abandoned. This invention, combined with the characteristics of the single texture and relatively fixed background of the oil spill target on the river surface, performs a large-scale static channel pruning on the encoder. Specifically, the number of output channels in the four feature extraction stages is compressed to [32, 64, 96, 128], respectively. This design significantly reduces the memory usage required for feature map storage while maintaining network depth. In response to the change in output dimension after encoder pruning, this invention constructs a lightweight decoding path that is strictly aligned with the encoder feature level. The number of channels in the three stages of the decoder is adapted and adjusted to [128, 96, 64]. To further reduce inference latency on edge devices, this invention designs a method where, when the decoder restores the image to 1 / 4 resolution (64 channels) of the original image, classification prediction is performed using a 1×1 convolutional layer. Subsequently, a 4x bilinear upsampling is used to restore the prediction results to the original size. This strategy avoids expensive convolutional operations at the highest resolution, effectively utilizes the high-resolution features of the encoder's first encoding stage, achieves an optimal balance between accuracy and speed, and significantly improves the model's real-time inference speed and energy efficiency in river oil spill detection tasks.
[0083] Furthermore, the training process of the DSAN-Unet network model is as follows:
[0084] Acquire video data of oil spills on the water surface; based on the video data, use the method of "fixed interval frame extraction + quality verification" to filter image frames to construct a basic dataset; enhance the basic dataset to construct an oil spill image dataset; crop the images in the oil spill image dataset to a preset size and label them by outlining them pixel by pixel to obtain a labeled dataset; divide the labeled dataset into a training set and a validation set.
[0085] The DSAN-Unet network model was trained using the training and validation sets. During the training process, Lovász-Softmax Loss was used as the loss function for optimization to obtain the trained DSAN-Unet network model.
[0086] It should be noted that this invention uses the Lovász-Softmax Loss instead of the traditional cross-entropy loss function to address the extreme "less oil, more water" category imbalance problem in river oil spill monitoring. This Lovász-Softmax Loss function directly optimizes the core metric of semantic segmentation—the Intersection over Union (IoU). Its specific calculation process is as follows:
[0087] First, the predicted feature map output by the network is normalized using Softmax to obtain the pixel... Predicted probability of belonging to category c Then, a pixel-level error vector is constructed, which quantitatively describes the degree to which the predicted result deviates from the true label, laying the foundation for subsequent gradient calculation:
[0088] ;
[0089] In the above formula, This represents the pixel index in the input image, where p is the total number of pixels; Indicates the first The real label of each pixel, when If the value is true, it indicates that the pixel belongs to target category c; otherwise, it is background. That is, the first The prediction error of each pixel in category c is constructed in a way that ensures the optimization direction of positive and negative samples is consistent.
[0090] Using the Lovász extension property, the discrete, non-differentiable Jaccard loss (i.e., 1-IoU) is transformed into a continuous convex function. First, the error term... Sort in descending order, generate a permutation , making The physical significance of this sorting step lies in prioritizing pixels with the greatest potential impact on IoU, thus enabling a global measurement of the error distribution. Subsequently, the Lovász-Softmax loss is calculated by linearly combining the sorted errors. :
[0091] ;
[0092] in, Represents the Jaccard loss set function The extended form of Lovász; Indicates the number after error sorting. The original pixel index corresponding to each position; For the sorted number Large error values; These are the weighting coefficients for the corresponding positions.
[0093] In the above formula, the weighting coefficients This represents the marginal gain of the set function. It is the key bridge connecting the loss function and the IoU metric. Its definition depends entirely on the cumulative change of the Jaccard loss over the sorted set:
[0094] ;
[0095] Here, Defined as a set function This formula shows that, Essentially quantified the first The error of a single pixel can cause a decrease in the overall IoU. If the error of a single pixel significantly reduces the Intersection over Union (IoU) (e.g., missing a tiny oil spill), the marginal gain calculated by this formula will be affected. This will cause a surge, thus assigning the pixel an extremely high gradient weight. This mechanism forces the network to prioritize correcting errors that are more prominent in the IoU metric during training, thereby achieving direct optimization of IoU.
[0096] To address the binary classification characteristics of oil spill monitoring on river surfaces, this invention directly applies the Lovász-Softmax Loss method to simultaneously optimize the intersection-union ratio (IUR) of the "oil spill foreground" and "water surface background." The final optimization objective function is defined as the arithmetic mean of the two types of substitution losses:
[0097] ;
[0098] Among them, L total This is the final total loss value. and Let represent the Jaccard loss convex substitution functions obtained by Lovász extension for the oil spill class and the background class, respectively. and These are the corresponding category error vectors. This design utilizes mathematical properties to automatically balance the attention given to positive and negative samples, effectively overcoming the segmentation challenge caused by extreme sample imbalance.
[0099] According to a second aspect of the present invention, a lightweight semantic segmentation device for water surface oil spills based on an improved U-Net is provided, comprising modules of the lightweight semantic segmentation method for water surface oil spills based on an improved U-Net as described above. Specifically, it includes: a first module for acquiring an image of the water surface oil spill to be segmented adjusted to a preset size and a trained DSAN-Unet network model; wherein the trained DSAN-Unet network model includes an encoder and a decoder connected by skip connections; a second module for using the image of the water surface oil spill to be segmented as input to the trained DSAN-Unet network model; the input image undergoes a first-channel pruning operation to extract an initial feature map, which is then fed into a four-stage encoder. Each encoding stage uses an improved DSAN module for local structure and texture information modeling, followed by downsampling; after encoding, the feature stream is transferred to the decoder, which uses a bottom-up, stage-by-stage feature recovery strategy based on the Ghost module and upsampling operations to fuse and reconstruct multi-scale features; the decoder output undergoes a second-channel pruning operation to output a pixel-level classification result consistent with the input size. For details not described in the above modules, please refer to the relevant descriptions in this embodiment.
[0100] According to a third aspect of the present invention, an edge device is provided, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the lightweight semantic segmentation method for water surface oil spills based on any of the above-described improved U-Net.
[0101] Example 2: The following describes optional embodiments of the present invention in conjunction with experiments:
[0102] Data acquisition for this experiment was conducted on an indoor simulated river experimental platform independently built at the outdoor experimental field of a maintenance and repair branch of the National Pipeline Group. The experimental platform constructed a near-realistic river surface optical environment by laying simulated riverbank vegetation and inserting oil spills with different diffusion patterns, such as... Figure 2 As shown ( Figure 2 (Scene before the oil spill was placed). This experiment was conducted on a high-performance deep learning workstation running Linux, with an Intel Core i7-14700KF CPU, 64GB of RAM, and an NVIDIA GeForce RTX 5080 GPU with 16GB of VRAM. The software environment was based on the PyTorch 2.10.0 deep learning framework accelerated by CUDA 12.8. The specific implementation process is as follows:
[0103] I. A ZED 2i binocular depth camera was used as the data acquisition device, with camera parameters set to a sampling frequency of 30Hz and an image resolution of 1920×1080. During data acquisition, to overcome the limitations of a single viewpoint and enhance the model's generalization ability to different observation locations, the camera was used to capture multi-directional images of the simulated oil spill process at different pitch angles, obtaining rich video data including those under different lighting conditions such as front lighting and backlighting.
[0104] Second, from the collected raw video data, 500 representative oil spill images were selected using a "fixed-interval frame extraction + quality verification" method to construct a basic dataset. The "fixed-interval frame extraction + quality verification" method specifically involves: first, extracting one image every 15 frames to initially obtain candidate images from the video data; then, removing blurry or out-of-focus low-quality images from the candidate images, retaining valid images that include "different oil spill diffusion patterns (point-like, sheet-like, film-like)," "different lighting angles (front lighting / backlighting / side lighting)," and "different background interferences (vegetation reflections, water ripple textures)," ultimately selecting 500 oil spill images covering various typical scenes as the basic dataset.
[0105] Third, various data augmentation processes were applied to the basic dataset, including random horizontal and vertical flipping to expand spatial orientation features; color jitter to simulate ambient light interference; random cropping to enhance local feature extraction capabilities; and Gaussian blur to simulate image defocusing. The basic dataset was expanded to 3,000 images to serve as an oil spill image dataset.
[0106] 4. Standardize the input size by cropping and scaling all images in the oil spill image dataset to a standard input size of 512×512 pixels. Use the image annotation tool LabelMe to perform pixel-level fine annotation on the 512×512 images: mark the "oil spill area" manually pixel by pixel, set the annotation category to "oil", and label the remaining areas as "background".
[0107] V. Following the principle of random sampling, the 3000 labeled images were divided into training and validation sets: 2700 images were used for iterative optimization of the DSAN-Unet network model parameters, and the remaining 300 images were used to evaluate the model's mIoU and other metrics in real time during training and to dynamically adjust hyperparameters. It should be noted that all network models used a uniform training configuration to ensure fairness in the comparison: the training and validation sets contained 2700 and 300 images respectively, the input image resolution was normalized to 512×512, the batch size was set to 4, and the total number of iterations was set to 300. Training process: The training set was input into the DSAN-Unet network model, and the validation set was used to monitor model performance in real time, adjust network weights, and save the optimal model weights after training.
[0108] VI. After model training, the trained network model is used to segment and monitor oil spill scene images on the water surface: The oil spill video stream to be detected (in this embodiment, the aforementioned validation set is further used as the oil spill video stream to be detected) is converted into a 512×512 format and then input into the trained DSAN-Unet network model. After one forward inference, the model outputs a pixel-level semantic segmentation mask with the same resolution as the original image by the decoder. This mask accurately delineates the edge morphology of the oil spill area by performing a binary classification of "oil spill / background" on each pixel on the feature map, thereby achieving accurate positioning and coverage monitoring of small oil spill targets on the river surface.
[0109] VII. Ablation Experiment.
[0110] To verify the technical effectiveness of this invention, an oil spill video stream to be detected was used as the test object to verify the semantic segmentation method for river surface oil spills of this invention. To comprehensively compare the model segmentation performance, the model prediction results are presented from a quantitative perspective.
[0111] To objectively evaluate the overall performance of the model in oil spill segmentation tasks, this invention selects the average intersection-over-union ratio (mIoU) as the core indicator for measuring segmentation accuracy. mIoU represents the average intersection-over-union ratio across all categories and comprehensively reflects the degree of overlap between the foreground (oil spill) and background (water surface) segments. Its calculation formula is as follows:
[0112] ;
[0113] Where k represents the upper limit of the category index (this invention includes two categories: oil spill and background, so i takes values of 0 and 1); TP represents a true positive, which represents the number of pixels in the oil spill area correctly identified by the model, that is, the prediction is oil spill and the true label is also oil spill; FP represents a false positive, which represents the number of pixels in the oil spill area that the model misreports, that is, the true label is water surface background, but the model incorrectly predicts it as oil spill; FN represents a false negative, which represents the number of pixels in the oil spill area that the model misses, that is, the true label is oil spill, but the model incorrectly predicts it as water surface background.
[0114] In addition, to evaluate the model's deployment potential on embedded edge devices, this invention uses the number of model parameters (M), floating-point operations (GFLOPs) (G), and frames per second (FPS) as evaluation metrics to measure the model's lightweight nature and real-time inference capabilities.
[0115] The constructed oil spill dataset has two pixel categories: oil spill and water background. The dataset contains 3000 images, with 2700 for training and 300 for validation.
[0116] To verify the performance improvement effects of each enhanced module, a series of ablation experiments were conducted on the validation set under the same training environment and hyperparameter configuration. Ablation experiments were carried out by progressively introducing the DSAN encoder, Half-Conv, Channel Pruning, Ghost module, and Lovász Loss onto the original U-Net baseline model. The results of the relevant ablation experiments are shown in Table 1.
[0117] The ablation experiments shown in Table 1 demonstrate the effectiveness of each improved module. First, the encoder of the baseline model U-Net was replaced with a traditional DSAN architecture (channel configuration [64, 128, 320, 512], corresponding to the second row of data in Table 1 excluding the header). Compared to the baseline model, this improvement significantly reduced the number of model parameters and GFLOPs by 54.7% and 88.4%, respectively, and increased the inference speed (FPS) from 67.81 to 121.20. Although the mIoU decreased slightly by 0.33 percentage points, this indicates that the DSAN structure effectively preserved core semantic features while significantly eliminating computational redundancy. Half-Conv+MLP was introduced on top of the baseline model U-Net, replacing all standard convolutions in the encoder except the first standard convolution with Half-Conv+MLP (corresponding to the third row of data in Table 1 excluding the header). Channel pruning is introduced on the baseline model U-Net (i.e., conv4×4 is introduced into the original U-Net encoder to extract preliminary feature maps, and conv3×3 is introduced as downsampling; the output of the decoder introduces "conv1×1 first, then 4x upsampling"), which corresponds to the fourth row of data in Table 1 (excluding the header). Ghost is also introduced on the baseline model U-Net (i.e., Ghost module is introduced into the original U-Net decoder to replace the standard convolution of the decoder), which corresponds to the fifth row of data in Table 1 (excluding the header).
[0118] Secondly, based on the traditional DSAN architecture, the Half-Conv and MLP strategies are introduced into each DSAN Block of the traditional DSAN architecture to form the improved DSAN module of this invention (corresponding to the sixth row of data in Table 1 excluding the header). Compared with the model of the previous stage (corresponding to the second row of data in Table 1 excluding the header), the addition of Half-Conv and MLP further reduces the number of parameters to 9.61M, while the FPS soars to 338.18 (an improvement of about 1.8 times). This shows that Half-Conv, through channel divide-and-conquer computation and MLP channel fusion, effectively avoids the memory access bottleneck and significantly accelerates the inference process while maintaining a basically stable mIoU (88.67%).
[0119] Building upon this, a Channel Pruning strategy was implemented (corresponding to the seventh row of data in Table 1, excluding the header), aiming to eliminate redundant channels during feature extraction. Compared to Unet + traditional DSAN + Half-Conv + MLP (corresponding to the sixth row of data in Table 1, excluding the header), the number of parameters in the pruned model dropped dramatically to 1.53M, and GFLOPs decreased to 8.63G. Surprisingly, mIoU actually rebounded by 0.15 percentage points to 88.82%, indicating that appropriate pruning not only reduced the model burden but also filtered out some noisy features, enhancing the purity of feature representation.
[0120] Subsequently, the Ghost module was introduced into the decoder to replace the standard convolution (corresponding to the eighth row of data in Table 1 excluding the header). This improvement further compressed the number of parameters to 0.81M, reduced GFLOPs to 2.55G, and dramatically increased FPS to 894.18. With almost lossless mIoU (88.81%), the Ghost module successfully generated rich feature maps using inexpensive linear operations, greatly freeing up hardware computing power.
[0121] Finally, the Lovász-Softmax Loss was introduced to address the class imbalance problem of "less oil and more water" in the river surface (data in the ninth row of Table 1 excluding the header), forming the final model of this invention. The introduction of Lovász Loss further improved mIoU to 88.95% on an extremely lightweight basis, only 0.18 percentage points lower than the original heavyweight U-Net, but achieved effective calibration of accuracy.
[0122] Compared to the original U-Net, the final improved model achieves a qualitative leap with only slight fluctuations in mIoU: the number of parameters and FLOPs are reduced by 96.7% and 99.4%, respectively, and the inference speed (FPS) is improved by 13 times (from 67.81 to 894.18). This result fully verifies the proposed "operator reconstruction + architecture slimming + loss optimization" combined strategy, which ensures both segmentation accuracy and adaptability to the real-time inference requirements of edge devices.
[0123] Table 1 Ablation Experiments of DSAN-Unet Model
[0124]
[0125] Note: "√" indicates that this option is used; "-" indicates that this option is not used.
[0126] 8. Testing of the embedded edge computing experimental platform.
[0127] To verify the practical deployment potential of DSAN-Unet in resource-constrained scenarios, this study constructed an embedded edge computing experimental platform based on NVIDIA Jetson Orin NX (16GB) to simulate a real river surface monitoring terminal. To ensure the fairness and comparability of the experimental results, all comparative models, including U-Net, MobileNet series, BiSeNetV2, and SegFormer, underwent inference testing in this unified hardware environment, and the corresponding frame rates (FPS) were measured. The software environment configuration is as follows: Python 3.8.10 was used as the programming language, and PyTorch 2.0.0+nv23.05, optimized for Jetson, was selected as the deep learning framework, integrating the CUDA 11.4 parallel architecture and the cuDNN 8.6 acceleration library. In addition, the TensorRT 5.1 engine was configured to optimize the models at the deployment level to fully utilize edge computing power.
[0128] In terms of quantitative performance analysis, DSAN-Unet demonstrates the best balance between accuracy and speed on this edge platform. Compared with the classic U-Net, this algorithm reduces the number of parameters by 96.7% (only 0.81 M) while maintaining a similar mIoU, and improves the inference speed by 22 times to 47.44 FPS. Compared with real-time networks such as BiSeNetV2 and STDC1, this algorithm effectively avoids the drawback of their significant decline in accuracy (the mIoU of the comparison models is generally below 85.10%). Even when facing the closest competitor, Fast-scnn (45.96 FPS), DSAN-Unet achieves a 1.33% mIoU advantage while slightly outperforming it in FPS. In addition, compared with the Transformer architecture SegFormer-b0, this model has only 1 / 4 of the number of parameters and is about 3 times faster inference, demonstrating its excellent adaptability to low-power devices, as shown in Table 2.
[0129] Qualitative visualization results further confirm the robustness of the model. For example... Figure 7As shown (the red area represents the detected oil spill area, and GT represents the true label after pixel-by-pixel annotation of the original image), for small and scattered oil spill targets, the comparative models (such as BiSeNetV2 and Fast-scnn) generally have serious false negatives (yellow box), while DSAN-Unet, thanks to the multi-scale feature extraction capability of the DSAN module, significantly reduces the false negative rate of small targets. In terms of boundary processing, MobileNet series and SegFormer often produce jagged edges or excessive smoothing (blue box), while this algorithm introduces GhostModule and Lovász Loss to effectively refine the edge contours, making them highly consistent with the true labels. At the same time, through the fusion of global context information, this model effectively suppresses false detections caused by strong reflections and water wave interference (purple box), meeting the needs of accurate monitoring in complex river environments.
[0130] Table 2 Comparison of DSAN-Unet with other detection methods
[0131]
[0132] The specific embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the present invention is not limited to the above embodiments. Within the scope of knowledge possessed by those skilled in the art, various changes can be made without departing from the spirit of the present invention.
Claims
1. A lightweight semantic segmentation method for oil spills on water surfaces based on an improved U-Net, characterized in that, include: Step 1: Obtain the oil spill image to be segmented on the water surface, adjusted to the preset size, and the trained DSAN-Unet network model; wherein, the trained DSAN-Unet network model includes an encoder and a decoder, and the two are connected by skip connections; Step 2: Use the oil spill image to be segmented as input to the trained DSAN-Unet network model; the input image is pruned in the first channel to extract the initial feature map, and the initial feature map is sent to the four-stage encoder. Each encoding stage uses the improved DSAN module for local structure and texture information modeling, followed by downsampling; after encoding is completed, the feature stream is transferred to the decoder. The decoder uses a bottom-up, step-by-step feature recovery strategy based on the Ghost module and upsampling to fuse and reconstruct multi-scale features. The decoder output is pruned in the second channel to output pixel-level classification results with the same size as the input.
2. The lightweight semantic segmentation method for oil spills on water surfaces based on improved U-Net according to claim 1, characterized in that, The first channel pruning operation specifically involves extracting an initial feature map with a resolution of 128×128 and a number of channels from the input image through a convolutional layer with a kernel size of 4×4 and a stride of 4.
3. The lightweight semantic segmentation method for oil spills on water surfaces based on improved U-Net according to claim 1, characterized in that, The encoder of the DSAN-Unet network model is specifically: In the first encoding stage, the initial feature map is first modeled with local structure and texture information by two layers of improved DSAN module to obtain a first encoding stage feature map with a resolution of 128×128 and 32 channels. Then, it is downsampled by a 3×3 convolutional layer with a stride of 2, which halves the feature resolution to 64×64 and expands the number of channels to 64. In the second encoding stage, the 64-channel features are further mined by the two-layer improved DSAN module to obtain the second encoding stage feature map with a resolution of 64×64 and a number of channels of 64. The feature resolution is halved to 32×32 and the number of channels is increased to 96 by the same downsampling operation as the first encoding stage. In the third encoding stage, a 3-layer improved DSAN module is applied to the 96-channel features to enhance the high-level semantic expression capability, resulting in a third encoding stage feature map with a resolution of 32×32 and 96 channels. Subsequently, the feature resolution is compressed to 16×16 and the number of channels is expanded to 128 through the same downsampling operation as in the first encoding stage. In the fourth encoding stage, a two-layer improved DSAN module is applied to the 128-channel features to further enhance the high-level semantic representation capability and stabilize the bottleneck feature representation, resulting in a fourth encoding stage feature map with a resolution of 16×16 and 128 channels.
4. The lightweight semantic segmentation method for oil spills on water surfaces based on improved U-Net according to claim 3, characterized in that, The improved DSAN module uses the Half-Conv module as its basic building block. The Half-Conv module splits the input feature map in two along the channel dimension: the first half of the channels undergoes depthwise separable convolution, while the second half of the channels is directly mapped using an identity to preserve the original context information. The two results are then concatenated along the channel dimension for output. Subsequently, the output of the Half-Conv module is concatenated with the original input feature map of the improved DSAN module. The concatenated result is then processed by BN and MLP modules, and the output is concatenated with the original input feature map of the improved DSAN module to obtain the final output.
5. The lightweight semantic segmentation method for oil spills on water surfaces based on improved U-Net according to claim 1, characterized in that, The decoder of the DSAN-Unet network model is specifically: In the first decoding stage, the 128-channel high-level features output from the encoder end are upsampled by 2 times and concatenated with the feature map of the third encoding stage with a resolution of 32×32 and 96 channels, so that the number of feature channels is expanded to 224. Then, the concatenated features are processed by two layers of Ghost modules in the first decoding stage to adjust the number of channels to 128, thereby realizing the fusion of high-level semantic information and low-level spatial details. In the second decoding stage, the 128-channel features output from the first decoding stage are upsampled by 2 times and then concatenated with the second-stage encoder feature map with a resolution of 64×64 and a channel count of 64, increasing the number of feature channels to 192. Subsequently, the concatenated features are processed through two layers of Ghost modules in the second decoding stage to adjust the number of channels to 96, thereby achieving the fusion of mid-level semantic information and spatial details. In the third decoding stage, the 96-channel features output from the second decoding stage are upsampled by 2 times and then concatenated with the first-stage encoder feature map, which has a resolution of 128×128 and 32 channels, to expand the number of feature channels to 128. The concatenated features are then processed by two layers of Ghost modules in the third decoding stage to adjust the number of channels to 64, thereby achieving the fusion of low-level semantic information and high-level spatial details.
6. The lightweight semantic segmentation method for oil spills on water surfaces based on improved U-Net according to claim 1, characterized in that, The second channel pruning operation is as follows: the feature map output by the decoder is classified and predicted by a convolutional layer with a kernel size of 1×1 and a stride of 2. Then, the prediction result is restored to the original size by 4 times upsampling, and the pixel-level classification result with the same input size is output.
7. The lightweight semantic segmentation method for oil spills on water surfaces based on improved U-Net according to claim 1, characterized in that, The training process of the DSAN-Unet network model is as follows: Acquire video data of oil spills on the water surface; based on the video data of oil spills on the water surface, use the method of "fixed interval frame extraction + quality verification" to filter image frames in order to construct a basic dataset; The base dataset was augmented to construct an oil spill image dataset; The images in the oil spill image dataset are cropped to a preset size and labeled pixel by pixel to obtain a labeled dataset; the labeled dataset is then divided into a training set and a validation set. The DSAN-Unet network model was trained using the training and validation sets. During the training process, Lovász-SoftmaxLoss was used as the loss function for optimization to obtain the trained DSAN-Unet network model.
8. The lightweight semantic segmentation method for oil spills on water surfaces based on the improved U-Net according to claim 7, characterized in that, The method of "fixed interval frame extraction + quality verification" is used to filter image frames to build a basic dataset. Specifically, candidate images are initially obtained from the video data by extracting one image at a frequency of one first preset number of frames; valid images are retained from the candidate images, and finally, a second preset number of oil spill images are selected as the basic dataset.
9. A lightweight semantic segmentation device for oil spills on water surfaces based on an improved U-Net, characterized in that, The module includes the lightweight semantic segmentation method for oil spills on the water surface based on the improved U-Net as described in any one of claims 1-8.
10. An edge device, comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the steps of the lightweight semantic segmentation method for oil spills based on the improved U-Net as described in any one of claims 1-8.