Next Article in Journal
Digital Twin Readiness of Mechanical Coffee Dryers: A Systematic Review
Previous Article in Journal
Multispectral UAV-Based Detection of Phytophthora in Citrus Orchards Using RF-DETR with Spectral Index Fusion
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A Lightweight Semantic Segmentation for Terrestrial Oil Spill Detection

School of Electrical and Information Engineering, Northeast Petroleum University, Daqing 163318, China
*
Author to whom correspondence should be addressed.
Appl. Sci. 2026, 16(17), 8458; https://doi.org/10.3390/app16178458
Submission received: 24 July 2026 / Revised: 16 August 2026 / Accepted: 23 August 2026 / Published: 25 August 2026
(This article belongs to the Section Computing and Artificial Intelligence)

Abstract

Accurate and timely monitoring of terrestrial oil spills is vital for ecological conservation and safe oilfield operations. To address the challenges of segmenting terrestrial oil spills in UAV remote sensing imagery, including blurred boundaries, irregular shapes, and complex background interference, we propose Fluid-SegFormer, a fluid-aware semantic segmentation model based on the lightweight SegFormer architecture. Fluid-SegFormer employs a Mix Transformer (MiT-B0) encoder to extract hierarchical multi-scale features and integrates a hierarchical fluid-aware optimization framework. Specifically, the Local Noise Gating (LNG) module suppresses background noise, the Horizontal–Vertical Perception Attention (HVPA) module enhances the structural representation of irregular oil spill regions, and the Fluid Soft Boundary Refinement Decoder (FSBRD) recovers fine boundary details. Experiments on a newly constructed high-resolution UAV terrestrial oil spill dataset demonstrate that Fluid-SegFormer achieves an mIoU of 87.84%, an IoU of 77.56%, and a Precision of 91.42%, effectively balancing computational efficiency and segmentation accuracy. These results demonstrate the potential of Fluid-SegFormer for practical deployment in UAV-based oil spill monitoring on edge devices.

1. Introduction

Oil spill accidents frequently occur during petroleum exploration, extraction, transportation, storage, and refining, posing serious threats to marine and terrestrial ecosystems as well as human society [1,2]. Major historical oil spill incidents, including the Hebei Spirit spill in 2007 [3,4] and the Deepwater Horizon (DWH) disaster in 2010 [5,6], have demonstrated that oil spills can spread over extensive areas, persist for long periods, and cause severe ecological damage. Oil contamination impedes gas exchange in water bodies, degrades soil structure, and suppresses microbial activity [7]. Such contamination is particularly destructive to sensitive ecosystems, including mangroves and wetlands, where long-term ecological degradation may persist [8]. Therefore, rapid and accurate detection of oil spill regions is crucial for effective environmental management, emergency response, and ecological risk assessment.
Traditional oil spill monitoring methods primarily rely on manual inspection, field sampling, and fixed sensors. However, these approaches are inefficient, have limited spatial coverage, and are highly susceptible to complex terrain and adverse weather, rendering them inadequate for large-scale, real-time monitoring requirements [7,9]. Remote sensing has emerged as an effective solution for automated oil spill detection owing to its non-contact operation, wide-area coverage, and high monitoring efficiency. Satellite remote sensing provides extensive spatial coverage, and platforms such as Sentinel-1 have been widely used for marine oil spill monitoring [10,11,12,13]. Nevertheless, constraints in orbital altitude, spatial resolution, and revisit frequency limit their capability for fine-grained detection in nearshore, port, and complex terrestrial environments [14]. In contrast, unmanned aerial vehicles (UAVs) offer flexible deployment, high spatial resolution, and low-altitude observation capabilities, making them well suited for oil spill monitoring in nearshore and terrestrial environments. Equipped with RGB, infrared, and multispectral sensors, UAVs can capture high-resolution imagery under diverse environmental conditions [15,16]. The increasing adoption of UAVs has also promoted the construction of high-resolution oil spill datasets. For example, Nafta2019 provides a representative dataset for oil-spill analysis in marine environments, comprising multi-source imagery acquired from UAVs, satellites, and other platforms. The dataset demonstrates the potential of remotely sensed and aerial imagery for oil spill detection and segmentation, while also reflecting the diversity of imaging platforms and viewpoints encountered in marine oil-spill monitoring [17]. Similarly, the Port Oil Spill Dataset introduced by De Kerf et al. consists of UAV-captured RGB images from port environments and includes oil, water, and other object categories [18]. Although these datasets provide valuable resources for oil spill analysis, they mainly represent marine or port environments and therefore do not fully capture the characteristics of oil spills occurring across heterogeneous terrestrial surfaces. These differences motivate the development of a dedicated benchmark for UAV-based terrestrial oil spill segmentation. Furthermore, advances in sensor miniaturization, onboard computing, and autonomous flight technologies are creating new opportunities for real-time UAV-based oil spill monitoring, but these applications also impose stringent requirements on spatial precision, inference efficiency, and robustness to complex terrestrial backgrounds.
Deep learning has significantly improved the accuracy and automation of oil spill analysis in remote sensing imagery. Initial studies primarily employed convolutional neural networks (CNNs) for oil spill classification and recognition [19,20]. Subsequent research extended to pixel-level semantic segmentation [21] and quantitative tasks, such as oil film thickness estimation [22]. More recently, segmentation models have progressively evolved from CNN-based architectures to Transformer-based frameworks [23]. Among these models, SegFormer achieves excellent segmentation performance owing to its lightweight Mix Transformer (MiT) encoder and effective decoder, which maintain low computational complexity and parameter count [24]. Driven by the growing demand for real-time inference and edge deployment, lightweight architectures, including FastSCNN [25], BiSeNetV2 [26], and EfficientViT [27], have been proposed to reduce model parameters and computational overhead.
Despite these advances, several challenges remain unresolved in UAV-based terrestrial oil spill monitoring. First, most existing studies focus on marine environments, where backgrounds are relatively homogeneous and oil-spill patterns are comparatively simple. In contrast, terrestrial scenes contain highly heterogeneous backgrounds, such as vegetation, bare soil, shadows, wet surfaces, and oilfield facilities, which can produce visual responses similar to those of oil spills. Second, oil-spill regions in RGB imagery often exhibit irregular shapes, elongated diffusion patterns, low contrast, and gradual boundary transitions. These characteristics become more challenging under varying illumination and adverse weather conditions, which can further alter the appearance of both oil spills and surrounding backgrounds. Under RGB-only observations, effective segmentation therefore requires not only distinguishing oil spills from complex and visually similar backgrounds, but also capturing their irregular fluid structures and preserving weak boundary cues. Conventional feature enhancement and multi-scale fusion strategies may inadequately model such directional structures and subtle boundary transitions, leading to false-positive responses, fragmented predictions, and inaccurate contour delineation. Third, UAV-based monitoring requires models that balance segmentation accuracy with computational efficiency. Although high-capacity segmentation networks can provide strong representation ability, their computational and memory requirements may hinder real-time inference on resource-constrained edge devices. These challenges indicate that a task-specific framework should jointly address background interference, irregular fluid structures, boundary ambiguity, and computational constraints.
To address these challenges, we propose Fluid-SegFormer, a task-oriented lightweight semantic segmentation framework tailored to oil spill segmentation in complex terrestrial environments and designed for edge deployment on UAVs. The proposed model enhances feature representation and boundary recovery under complex backgrounds while preserving computational efficiency. In addition, we establish a UAV-based terrestrial oil spill dataset (UTOSD), consisting of 665 high-resolution images with pixel-level annotations, to provide a benchmark for developing and evaluating terrestrial oil spill segmentation methods. We conduct comprehensive comparative experiments under a unified framework, benchmarking against DeepLabV3+ [28], U-Net [29], PSPNet [30], HRNet [31], BiSeNetV2, FastSCNN, and SegFormer.
The main contributions of this work are summarized as follows:
  • We establish UTOSD, a UAV-based terrestrial oil spill dataset comprising 665 high-resolution RGB images with pixel-level annotations. The dataset covers diverse terrestrial backgrounds, including vegetation, bare soil, snow-covered areas, and oilfield facilities, providing a dedicated benchmark for terrestrial oil spill segmentation.
  • We propose Fluid-SegFormer, a task-specific lightweight semantic segmentation framework for UAV-based terrestrial oil spill monitoring. By integrating shallow noise suppression, deep directional feature modeling, and soft-boundary refinement into the SegFormer architecture, the framework improves the representation of irregular oil spill regions and ambiguous boundaries while maintaining low computational complexity.
  • We conduct comprehensive, unified evaluations showing that Fluid-SegFormer achieves superior performance and robustness compared to mainstream semantic segmentation baselines.

2. Materials and Methods

2.1. Dataset Collection and Processing

UTOSD consists of 665 high-resolution RGB images. These images were acquired using DJI Matrice-series UAVs (DJI, Shenzhen, China) over oilfields and their surrounding environments. Data were collected at multiple flight altitudes, times of day, and illumination conditions across challenging representative terrestrial scenes, including grasslands (Figure 1a), bare soil (Figure 1b), snow-covered areas (Figure 1c), and oilfield facilities (Figure 1d). The annotation process was carried out using LabelMe and subsequently converted into Pascal VOC-compliant binary masks, where pixel values of 0 and 1 represent the background and oil spill classes, respectively. Statistical analysis reveals that oil spill regions exhibit considerable variability in shape and scale, occupying only 7.9% of each image area on average. Moreover, their visual appearance is often similar to wet soil, shadows, and surface reflections, making accurate segmentation particularly challenging. To prevent data leakage caused by consecutive aerial image sequences, the dataset was divided according to independent flight routes into training, validation, and test sets in an 8:1:1 ratio, comprising 532, 66, and 67 images, respectively.
During training, Z-score normalization based on ImageNet statistics was first applied to standardize the input images. To improve model generalization, online data augmentation strategies were adopted, including random scaling (0.5–2.0), random cropping (512 × 512 pixels), random horizontal and vertical flipping (p = 0.5), and photometric adjustments. In addition, the input image size was constrained to multiples of 32 to align with multi-scale feature maps. Padded image regions were filled with a value of 0, while the corresponding label regions were assigned an ignore index of 255, preventing them from contributing to loss computation. During validation and testing, only normalization and fixed-size resizing were applied to ensure a consistent and reproducible evaluation protocol.

2.2. Model Structure

2.2.1. Overall Method Framework

Figure 2 presents the overall architecture of Fluid-SegFormer. The model employs a lightweight Mix Transformer (MiT-B0) encoder to extract hierarchical features at four scales (1/4, 1/8, 1/16, and 1/32), balancing local details with global semantic representations.
Considering the distinct semantic characteristics and noise distributions across different feature stages, we design a hierarchical fluid-aware feature regulation framework. Specifically, the Local Noise Gating (LNG) module is embedded into the shallow feature stages to suppress background interference and enhance low-level feature quality. At the deep feature stages, the Horizontal–Vertical Perception Attention (HVPA) module strengthens directional structural perception. During decoding, the Fluid Soft-Boundary Refinement Decoder (FSBRD) progressively restores boundary information lost during multi-scale feature fusion and refines object contours through soft-boundary reconstruction.
Unlike conventional segmentation models that apply a uniform feature enhancement strategy across all feature levels, Fluid-SegFormer performs stage-specific feature optimization according to the characteristics of hierarchical representations. The proposed framework effectively suppresses background interference while preserving the structural integrity and boundary continuity of fluid-like oil spill regions, thereby improving segmentation accuracy in complex terrestrial environments.

2.2.2. Local Noise Gating Module

The shallow features (F1 and F2) contain rich texture and edge information, providing essential cues for oil spill localization. However, these feature maps also retain abundant high-frequency background responses, including soil textures, vegetation shadows, wet surfaces, and oilfield facilities, which often obscure discriminative oil spill features. To address this issue, we introduce the LNG module into the shallow feature stages to adaptively suppress background noise and enhance feature responses in oil spill regions.
LNG is built upon the Convolutional Block Attention Module (CBAM) and comprises two sequential components: channel attention followed by spatial attention [32]. Its overall architecture is illustrated in Figure 3. By jointly modeling feature importance along the channel and spatial dimensions, LNG recalibrates shallow feature representations, highlighting oil spill related features while suppressing background noise.
The input feature is multiplied element-wise with the channel attention weights to obtain the intermediate feature, the computational process is formulated in Equation (1):
F = F M C ( F )
where F denotes channel-attention operations.
Then the F enters the spatial attention submodule, and is multiplied element-wise by the spatial attention weights to obtain the output feature, the computational process is formulated in Equation (2):
F o u t = F M s ( F )
where M s F denotes aspatial-attention operations.

2.2.3. Horizontal–Vertical Perception Attention Module

The deepest feature map, F4, encodes high-level semantic representations that are essential for distinguishing oil spill regions from complex backgrounds. However, most conventional spatial attention mechanisms rely on two-dimensional global pooling, which is insufficient to capture the elongated and irregular fluid diffusion patterns of oil spill regions. To overcome this limitation, we introduce the HVPA module, as shown in Figure 4. Inspired by the directional modeling strategy of Strip Pooling [33], HVPA decouples spatial contextual information into horizontal and vertical branches for independent modeling.
Given the input feature map F4, the horizontal and vertical branches first pass through adaptive one-dimensional pooling layers, followed by directional convolutions (3 × 1 and 1 × 3) to generate feature vectors. The computational process is formulated in Equations (3) and (4):
y h = C o n v 3 × 1 ( P o o l H × 1 ( X ) )
y w = C o n v 1 × 3 ( P o o l 1 × w ( X ) )
The horizontal and vertical features are subsequently aligned through a broadcast operation and fused via element-wise addition. The fused features are then processed through 1 × 1 convolution and batch normalization (BN) to generate the criss-cross attention map. Finally, the attention map is multiplied element-wise with the original feature F4 to obtain the refined output feature, The computational process is formulated in Equation (5):
F o u t = F d e e p σ ( B N ( C o n v 1 × 1 ( y h y w ) ) )
where σ ( · ) represents the sigmoid activation function, which maps the output to the [0, 1] interval to generate the attention weights.
By integrating feature responses from both branches, HVPA strengthens the representation of fluid diffusion structures and enhances the discriminative capability of deep semantic features.

2.2.4. Fluid Soft-Boundary Refinement Decoder

The SegFormer decoder performs multi-scale feature fusion through linear projection and feature concatenation, effectively aggregating semantic information across different feature levels. However, for terrestrial oil spills with gradual boundaries and low visual contrast, this fusion process often weakens boundary representations, leading to blurred contours and the loss of fine structural details in the final predictions. To better preserve boundary transition information, we introduce the FSBRD, as illustrated in Figure 5. FSBRD takes the fused feature map as input and employs a boundary-aware branch and a detail extraction branch.
Specifically, the boundary-aware branch generates a soft-boundary attention map by combining average pooling and max-pooling, thereby emphasizing the gradual transitions between oil spill regions and the background. The computation is formulated as:
A _ b o u n d = σ ( C o n v 7 × 7 ( [ M e a n ( F f u s e d ) ; M a x ( F f u s e d ) ] ) )
In parallel, the detail extraction branch employs depthwise convolution to extract fine-grained local texture information while maintaining computational efficiency. The computation is expressed as:
F d e t a i l = R e L U ( B N ( C o n v D W ( F f u s e d ) ) )
Finally, the soft-boundary attention map is applied to the extracted detail features through element-wise multiplication, and the refined features are fused with the input features via a residual connection to generate the final output feature. The final refinement process is formulated as:
F o u t = F f u s e d ( F d e t a i l A b o u n d )

2.2.5. Loss Function and Optimizer

Terrestrial oil spill segmentation is modeled as a pixel-level binary semantic segmentation task. Considering the binary nature of the task, binary cross-entropy (BCE) loss provides a simple and effective optimization objective for pixel-wise classification, which is defined as:
L B C E = 1 N i = 1 N [ y i log ( p i ) + ( 1 y i ) log ( 1 p i ) ]
where y i denotes the ground-truth label, p i denotes the predicted probability, and N is the total number of pixels.
Model parameters are updated using the AdamW optimizer throughout the training process.

3. Results and Discussion

3.1. Experimental Setup

To evaluate the effectiveness of Fluid-SegFormer in UAV-based terrestrial oil spill segmentation, comparative experiments were conducted on the UTOSD. All competing models were trained using the same data partitioning, input resolution, and optimization strategy. We set a fixed random seed and unified the hyperparameters to minimize the influence of stochastic variation. All models were initialized with the Cityscapes pretrained weights and subsequently fine-tuned on the UTOSD. Experiments were implemented using the MMSegmentation framework and executed under a unified hardware and software environment, as detailed in Table 1.

3.2. Evaluation Metrics

To comprehensively evaluate segmentation performance, five widely used metrics were adopted: Intersection over Union (IoU), Mean Intersection over Union (mIoU), Precision, Recall, and F1-score (F1). These metrics assess the model from multiple perspectives, including regional overlap, overall segmentation quality, and classification performance. For this binary segmentation task, the classes are background and oil spill.
1. The IoU measures the overlap between the predicted region and the ground-truth region:
I o U = T P T P + F P + F N
where TP, FP, and FN denote the number of true positive, false positive, and false negative pixels, respectively.
2. The mIoU is the average IoU across all classes:
m I o U = 1 N i = 1 N I o U i
This study addresses a binary semantic segmentation task with N = 2 classes, namely background and oil spill.
3. The Precision measures the proportion of correctly predicted positive pixels among all predicted positive pixels:
P r e c i s i o n = T P T P + F P
4. The Recall measures the proportion of correctly detected positive pixels among all actual positive pixels:
R e c a l l = T P T P + F N
5. The F1-score is the harmonic mean of Precision and Recall:
F 1 - s c o r e = 2 × P r e c i s i o n × R e c a l l P r e c i s i o n + R e c a l l = 2 T P 2 T P + F P + F N

3.3. Semantic Segmentation Experiment of UTOSD

We evaluated the Fluid-SegFormer model on the UTOSD against five representative segmentation models, as shown in Table 2.
The evaluated models exhibit substantial differences in architecture, computational complexity, and inference efficiency. Among them, U-Net relies on encoder–decoder feature fusion and PSPNet aggregates multi-scale contextual information through pyramid pooling, but their relatively high computational costs (203 and 179 GFLOPs, respectively) limit their inference speeds to 3.06 FPS and 8.01 FPS. FastSCNN employs a lightweight two-branch design for real-time segmentation, while BiSeNetV2 uses a detail branch and a semantic branch to balance spatial details and semantic information. However, their lightweight designs, which emphasize efficient feature extraction, provide limited feature representation for the irregular and low-contrast oil-spill regions. SegFormer reduces the computational cost to 7.88 GFLOPs with only 3.72 M parameters. Building upon this lightweight architecture, Fluid-SegFormer slightly increases the computational cost to 7.96 GFLOPs and 4.19 M parameters. Although the proposed feature optimization modules decrease the inference speed to 13.76 FPS compared with the original SegFormer, the model still achieves a processing rate close to real-time requirements for many UAV monitoring applications.
In terms of segmentation performance, Fluid-SegFormer demonstrates competitive overall performance. It achieves an mIoU of 87.84%, an IoU of 77.56%, a Precision of 91.42%, and an F1-score of 87.36%. Notably, the Precision improves by 5.04 percentage points over the baseline, indicating more effective suppression of false positives in complex backgrounds. The Fluid-SegFormer achieves a recall of 83.65%, which is slightly lower than PSPNet (86.68%) and the original SegFormer (86.32%). This result demonstrates the inherent precision–recall trade-off in semantic segmentation tasks. The proposed model adopts a more conservative prediction strategy by suppressing false-positive responses while preserving the dominant oil spill regions. Although PSPNet achieves a higher Recall, its Precision is only 84.87%, suggesting a tendency toward over-segmentation.
Fluid-SegFormer achieves the highest F1 and oil spill IoU among all compared models, demonstrating its capability to accurately recover both the spatial distribution and boundary structures of oil spill regions in complex terrestrial environments. The proposed method achieves an effective balance between segmentation accuracy, false-positive suppression, and computational efficiency, making it well-suited for edge deployment in UAV-based monitoring applications.
To examine whether the choice of loss function affects segmentation performance under the class-imbalanced characteristics of terrestrial oil spill images, we further compared the BCE and Focal Loss functions while keeping the network architecture and training settings unchanged. The results are summarized in Table 3.
The BCE-based model achieves substantially better overall segmentation performance, with an mIoU of 87.84%, compared with 80.35% obtained using Focal Loss. In particular, Focal Loss reduces the oil-spill IoU and Recall to 63.70% and 68.36%, respectively, indicating that its emphasis on difficult pixels does not necessarily translate into better segmentation of the weakly defined oil-spill regions in this dataset. Therefore, BCE was retained as the final optimization objective.

3.4. Five-Fold Cross-Validation

To further assess the stability of the proposed model and reduce the dependence on a single train-validation-test partition, we conducted five-fold cross-validation on the complete UTOSD. The 665 images were divided into five folds of approximately 133 images each. In each round, three folds (60%) were used for training, one fold (20%) for validation, and the remaining fold (20%) for testing. The five folds were rotated so that each image was used for testing once. The same training configuration and model selection strategy were maintained across all folds.
Fluid-SegFormer achieved an oil-spill IoU of 76.87 ± 1.61%, compared with 75.52 ± 1.62% for SegFormer-B0. The proposed model consistently outperformed the baseline across all five folds, with an average improvement of 1.35 percentage points. A paired t-test further indicated a statistically significant difference between the two methods (t = 3.17, p = 0.034), providing additional evidence of the robustness of the proposed method across different data partitions.

3.5. Visual Analysis

For qualitative visualization, we selected PSPNet, SegFormer-B0, and the proposed Fluid-SegFormer for visual comparison. The quantitative results of the remaining models are presented in Table 2. Figure 6 presents the segmentation results under six representative terrestrial oil-spill scenarios: vegetation shadow occlusion (Figure 6a), bare-soil texture interference (Figure 6b), highly heterogeneous surfaces with oilfield facility interference (Figure 6c), ditch-constrained oil spill propagation (Figure 6d), hay and muddy-water interference (Figure 6e) and highly cluttered background (Figure 6f).
PSPNet exhibits frequent missed detections and incomplete object boundaries across all challenging scenarios, indicating limited capability in identifying low-contrast oil spill regions. In particular, it fails to identify the fragmented oil spill regions on the right side of Figure 6a and the faint seepage area at the top of Figure 6c. SegFormer-B0 correctly recovers the major oil spill regions. However, it produces fragmented predictions and blurred boundaries when segmenting elongated oil spills with complex morphologies, as illustrated in Figure 6c,d.
By comparison, the proposed model produces more consistent segmentation results across all scenarios. Under vegetation shadow and bare soil texture interference (Figure 6a,b), the proposed model clearly separates oil spill regions from confusing background textures, reducing false detections. In the highly heterogeneous scene (Figure 6c), it better preserves the spatial connectivity. In the ditch-constrained propagation scenario (Figure 6d), the proposed model retains boundary contours and fine details of thin oil films despite their blurred boundaries and strong visual similarity to the surrounding background, producing segmentation results that more closely match the ground truth. In the hay and muddy-water interference scenario (Figure 6e), Fluid-SegFormer recovers most of the fragmented oil-spill regions and provides a segmentation pattern closer to the ground truth, although some small regions remain missed. Under the highly cluttered background in Figure 6f, the proposed model better preserves the main irregular oil-spill structures than PSPNet and SegFormer-B0, but localized false-positive responses and minor omissions can still be observed. These results indicate that the proposed model improves the robustness of oil-spill segmentation under challenging terrestrial conditions, while its performance under highly ambiguous backgrounds still warrants further improvement.

3.6. Ablation Experiment

To evaluate the independent contributions and synergistic effects of each module, we conducted ablation experiments using SegFormer-B0 as the baseline under identical experimental conditions. The results are presented in Table 4.
The baseline SegFormer-B0 achieved an mIoU of 82.93%, a Recall of 86.32%, and a Precision of 86.38%, with 3.72 M parameters and 7.88 GFLOPs. The relatively high Recall indicates that the model effectively covers the target regions, whereas the lower Precision suggests a higher false-positive rate in complex terrestrial environments.
After introducing LNG, mIoU and Precision increased to 86.90% and 88.85%, respectively, while the parameter count and computational cost increased only marginally to 3.74 M and 7.89 GFLOPs. These results demonstrate that shallow-stage noise suppression effectively reduces background interference and enhances feature discriminability. However, Recall decreased slightly, suggesting a more conservative prediction strategy. When HVPA was introduced independently, the oil spill IoU increased to 76.58%, while Precision improved to 89.44%. The parameter count increased to 4.18 M with 7.90 GFLOPs, indicating that HVPA enhances the structural feature representation of oil spill regions. When FSBRD was applied independently, the oil spill IoU reached 77.40% while Recall remained nearly unchanged, with only 3.72 M parameters and 7.93 GFLOPs, this result indicates that boundary refinement effectively recovers fine contour details without substantially increasing the model complexity.
When LNG and HVPA were jointly integrated, Precision further increased to 90.81%, indicating that noise suppression and structural modeling have complementary effects. Nonetheless, Recall remained relatively low at 83.63%. The combined model contained 4.19 M parameters and required 7.91 GFLOPs, demonstrating that the two modules improve segmentation performance with limited computational overhead. After further integrating FSBRD, Fluid-SegFormer achieved the best overall performance. Specifically, the Precision, IoU, and F1 reached 91.42%, 77.56%, and 87.36%, respectively. Meanwhile, Recall recovered slightly, suggesting that FSBRD further compensates for boundary information loss introduced during the preceding optimization stages, thereby improving the overall segmentation quality. The complete Fluid-SegFormer contains 4.19 M parameters and requires 7.96 GFLOPs, representing only a marginal increase in computational cost compared with the baseline SegFormer-B0 (3.72 M parameters and 7.88 GFLOPs), while achieving substantial improvements in segmentation performance.
The LNG, HVPA, and FSBRD perform background noise suppression, fluid structure modeling, and boundary refinement recovery, respectively. Their collaboration effectively improves segmentation accuracy, boundary integrity, and overall model performance in complex terrestrial environments.

3.7. Decision Threshold Sensitivity and Deployment

To further evaluate the ability of Fluid-SegFormer to preserve gradual boundary transitions, we conducted a decision threshold sensitivity analysis, and the results are summarized in Table 5.
The results show that the model achieves the highest Precision (91.42%) at a decision threshold of 0.45, demonstrating effective suppression of false-positive predictions in complex backgrounds. When the threshold is reduced to 0.35, the model achieves optimal overall performance, with an mIoU of 88.11%, an IoU of 78.11%, an F1 of 87.71%, and a Recall of 86.62%. Compared with the threshold of 0.45, lowering the threshold to 0.35 increases IoU, Recall, and F1 by 0.55, 2.97, and 0.35 percentage points, respectively. This improvement indicates that more transitional boundary regions are successfully identified, resulting in more complete segmentation and improved boundary continuity. Furthermore, within the threshold range of 0.25–0.45, the maximum variations in mIoU and F1-score are only 0.50 and 0.53 percentage points, respectively, demonstrating strong robustness to threshold selection. In practical UAV-based oil spill monitoring, different application scenarios require different trade-offs between false-positive and false-negative predictions. Therefore, the decision threshold can be flexibly adjusted to balance Precision and Recall, enabling Fluid-SegFormer to accommodate diverse application requirements, such as environmental monitoring, contamination assessment, and early warning.

3.8. Evaluation of Cross-Scene Transferability and Robustness

To evaluate the cross-scene transferability, robustness, and adaptation efficiency of Fluid-SegFormer, we conducted transfer learning experiments using a publicly available port oil spill dataset [22]. The dataset contains representative harbor scenes, including port terminals, ship berthing areas, and nearshore waters, which differ substantially from the terrestrial oil spill dataset in background composition, texture characteristics, and target distribution. A total of 571 images were selected and randomly divided into training, validation, and test sets in an 8:1:1 ratio. All models were initialized with weights pretrained on UTOSD and subsequently fine-tuned and evaluated on the port dataset. The results are summarized in Table 6.
Fluid-SegFormer maintains strong segmentation performance in the port scenarios, achieving an IoU of 82.11%, a Precision of 86.74%, a Recall of 93.90%, and an F1 of 90.18%. Relative to the baseline SegFormer, Fluid-SegFormer achieves comparable IoU performance while providing improvements in Recall and F1-score. Although Fluid-SegFormer was designed for terrestrial oil spill segmentation, it achieves superior overall performance in port water environments. These results demonstrate the transferability of the proposed hierarchical fluid-aware framework across substantially different oil spill scenes, suggesting that its learned feature regulation is not limited to the terrestrial characteristics of UTOSD.

4. Conclusions

This study proposes Fluid-SegFormer, a lightweight fluid-aware semantic segmentation model, to address complex background interference, ambiguous oil spill boundaries, and limited computational resources for edge deployment in UAV-based terrestrial oil spill monitoring. The proposed approach is systematically validated on a newly constructed dataset of terrestrial oil spills. In addition, the newly constructed dataset provides a benchmark for future research on UAV-based terrestrial oil spill segmentation.
Experimental results demonstrate that Fluid-SegFormer achieves high segmentation accuracy with low computational complexity, achieving an effective balance between accuracy and efficiency. Compared with representative semantic segmentation models, Fluid-SegFormer delivers more accurate boundary delineation and stronger background suppression in complex terrestrial environments. Evaluation of Cross-Scene Transferability and Robustness experiments and decision-threshold sensitivity analysis verify that the proposed method maintains stable segmentation performance across diverse scenarios and threshold settings, demonstrating the robustness and adaptability of the proposed framework for practical UAV deployment. These findings indicate that integrating fluid–structure perception with soft-boundary refinement into a lightweight segmentation framework effectively enhances fine-grained oil spill recognition, offering a promising technical solution for intelligent UAV-based environmental monitoring and emergency response.
Despite these encouraging results, several limitations remain. The current study focuses primarily on RGB UAV imagery, and its generalization capability under extreme weather, severe illumination variations, and more complex environments warrants further investigation. Future work will investigate multimodal remote sensing data, including infrared and SAR imagery, together with larger and more geographically diverse datasets to further enhance model generalization. In addition, further optimization of the model architecture will also be pursued to improve detection accuracy, robustness, and deployment efficiency on resource-constrained edge devices. Class-imbalance-aware and hybrid loss functions will also be investigated to refine the segmentation performance of small-scale and weakly defined oil-spill regions.

Author Contributions

Conceptualization, H.C.; methodology, H.C.; software, H.C.; validation, H.C.; resources, K.S.; data curation, H.C.; writing—original draft preparation, H.C.; writing—review and editing, K.S.; visualization, H.C.; supervision, K.S.; project administration, K.S. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The UTOSD generated during this study has been deposited in Zenodo and assigned the DOI 10.5281/zenodo.21511061. The dataset is currently under embargo and will be made publicly available upon publication of this article through the corresponding DOI.

Acknowledgments

During the preparation of this manuscript, the authors used ChatGPT-5.5 to assist with grammar checking, language polishing, and improving the overall fluency of the text. The authors have reviewed and edited the output and take full responsibility for the content of this publication.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. de Oliveira, O.M.C.; Queiroz, A.F.d.S.; Cerqueira, J.R.; Soares, S.A.R.; Garcia, K.S.; Filho, A.P.; Rosa, M.d.L.d.S.; Suzart, C.M.; Pinheiro, L.d.L.; Moreira Í, T.A. Environmental disaster in the northeast coast of Brazil: Forensic geochemistry in the identification of the source of the oily material. Mar. Pollut. Bull. 2020, 160, 111597. [Google Scholar] [CrossRef] [Scilit]
  2. Li, P.; Cai, Q.; Lin, W.; Chen, B.; Zhang, B. Offshore oil spill response practices and emerging challenges. Mar. Pollut. Bull. 2016, 110, 6–27. [Google Scholar] [CrossRef] [Scilit]
  3. Hong, S.; Khim, J.S.; Ryu, J.; Kang, S.-G.; Shim, W.J.; Yim, U.H. Environmental and ecological effects and recoveries after five years of the Hebei Spirit oil spill, Taean, Korea. Ocean Coast. Manag. 2014, 102, 522–532. [Google Scholar] [CrossRef] [Scilit]
  4. Yim, U.H.; Kim, M.; Ha, S.Y.; Kim, S.; Shim, W.J. Oil spill environmental forensics: The Hebei Spirit oil spill case. Environ. Sci. Technol. 2012, 46, 6431–6437. [Google Scholar] [CrossRef] [Scilit]
  5. Beyer, J.; Trannum, H.C.; Bakke, T.; Hodson, P.V.; Collier, T.K. Environmental effects of the Deepwater Horizon oil spill: A review. Mar. Pollut. Bull. 2016, 110, 28–51. [Google Scholar] [CrossRef] [Scilit]
  6. Michel, J.; Owens, E.H.; Zengel, S.; Graham, A.; Nixon, Z.; Allard, T.; Holton, W.; Reimer, P.D.; Lamarche, A.; White, M.; et al. Extent and degree of shoreline oiling: Deepwater Horizon oil spill, Gulf of Mexico, USA. PLoS ONE 2013, 8, e65087. [Google Scholar] [CrossRef] [Scilit]
  7. Al-Ruzouq, R.; Gibril, M.B.A.; Shanableh, A.; Kais, A.; Hamed, O.; Al-Mansoori, S.; Khalil, M.A. Sensors, Features, and Machine Learning for Oil Spill Detection and Monitoring: A Review. Remote Sens. 2020, 12, 3338. [Google Scholar] [CrossRef] [Scilit]
  8. Lassalle, G.; Scafutto, R.D.M.; Lourenço, R.A.; Mazzafera, P.; de Souza Filho, C.R. Remote sensing reveals unprecedented sublethal impacts of a 40-year-old oil spill on mangroves. Environ. Pollut. 2023, 331, 121859. [Google Scholar] [CrossRef] [Scilit]
  9. Dong, S.; Feng, J.; Gu, Z.; Yin, K.; Long, Y. A Review of Artificial Intelligence and Remote Sensing for Marine Oil Spill Detection, Classification, and Thickness Estimation. Remote Sens. 2025, 17, 3681. [Google Scholar] [CrossRef] [Scilit]
  10. Baghdady, S.M.; Abdelsalam, A.A. Ten years of oil pollution detection in the Eastern Mediterranean shipping lanes opposite the Egyptian coast using remote sensing techniques. Sci. Rep. 2024, 14, 18057. [Google Scholar] [CrossRef] [Scilit]
  11. Sun, Z.; Yang, Q.; Yan, N.; Chen, S.; Zhu, J.; Zhao, J.; Sun, S. Utilizing deep learning algorithms for automated oil spill detection in medium resolution optical imagery. Mar. Pollut. Bull. 2024, 206, 116777. [Google Scholar] [CrossRef] [Scilit]
  12. Temitope Yekeen, S.; Balogun, A.-L. Advances in Remote Sensing Technology, Machine Learning and Deep Learning for Marine Oil Spill Detection, Prediction and Vulnerability Assessment. Remote Sens. 2020, 12, 3416. [Google Scholar] [CrossRef] [Scilit]
  13. Yang, J.; Wan, J.; Ma, Y.; Zhang, J.; Hu, Y. Characterization analysis and identification of common marine oil spill types using hyperspectral remote sensing. Int. J. Remote Sens. 2020, 41, 7163–7185. [Google Scholar] [CrossRef] [Scilit]
  14. Bui, N.A.; Oh, Y.; Lee, I. Oil spill detection and classification through deep learning and tailored data augmentation. Int. J. Appl. Earth Obs. Geoinf. 2024, 129, 103845. [Google Scholar] [CrossRef] [Scilit]
  15. Aromoye, I.A.; Lo, H.H.; Sebastian, P.; Ayinla, S.L.; Abro, G.E.M. Significant Advancements in UAV Technology for Reliable Oil and Gas Pipeline Monitoring. Comput. Model. Eng. Sci. 2025, 142, 1155–1197. [Google Scholar] [CrossRef] [Scilit]
  16. Asadzadeh, S.; Oliveira, W.J.d.; Souza Filho, C.R.d. UAV-based remote sensing for the petroleum industry and environmental monitoring: State-of-the-art and perspectives. J. Pet. Sci. Eng. 2022, 208, 109633. [Google Scholar] [CrossRef] [Scilit]
  17. Ghorbani, Z.; Behzadan, A.H. Monitoring offshore oil pollution using multi-class convolutional neural networks. Environ. Pollut. 2021, 289, 117884. [Google Scholar] [CrossRef] [Scilit]
  18. De Kerf, T.; Sels, S.; Samsonova, S.; Vanlanduit, S. A dataset of drone-captured, segmented images for oil spill detection in port environments. Sci. Data 2024, 11, 1180. [Google Scholar] [CrossRef] [Scilit]
  19. Basit, A.; Siddique, M.A.; Bashir, S.; Naseer, E.; Sarfraz, M.S. Deep Learning-Based Detection of Oil Spills in Pakistan’s Exclusive Economic Zone from January 2017 to December 2023. Remote Sens. 2024, 16, 2432. [Google Scholar] [CrossRef] [Scilit]
  20. Song, D.; Zhen, Z.; Wang, B.; Li, X.; Gao, L.; Wang, N.; Xie, T.; Zhang, T. A Novel Marine Oil Spillage Identification Scheme Based on Convolution Neural Network Feature Extraction From Fully Polarimetric SAR Imagery. IEEE Access 2020, 8, 59801–59820. [Google Scholar] [CrossRef] [Scilit]
  21. Hasimoto-Beltran, R.; Canul-Ku, M.; Díaz Méndez, G.M.; Ocampo-Torres, F.J.; Esquivel-Trava, B. Ocean oil spill detection from SAR images based on multi-channel deep learning semantic segmentation. Mar. Pollut. Bull. 2023, 188, 114651. [Google Scholar] [CrossRef] [Scilit]
  22. Garcia-Pineda, O.; Staples, G.; Jones, C.E.; Hu, C.; Holt, B.; Kourafalou, V.; Graettinger, G.; DiPinto, L.; Ramirez, E.; Streett, D.; et al. Classification of oil spill by thicknesses using multiple remote sensors. Remote Sens. Environ. 2020, 236, 111421. [Google Scholar] [CrossRef] [Scilit]
  23. Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser, Ł.; Polosukhin, I. Attention is all you need. In Proceedings of the 31st International Conference on Neural Information Processing Systems (NeurIPS 2017), Long Beach, CA, USA, 4–9 December 2017; pp. 5998–6008. [Google Scholar] [CrossRef] [Scilit]
  24. Xie, E.; Wang, W.; Yu, Z.; Anandkumar, A.; Alvarez, J.M.; Luo, P. SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers. In Proceedings of the 35th Conference on Neural Information Processing Systems (NeurIPS 2021), Virtual Event, 6–14 December 2021; pp. 12077–12090. [Google Scholar] [CrossRef] [Scilit]
  25. Poudel, R.P.K.P.; Liwicki, S.; Cipolla, R. Fast-SCNN: Fast Semantic Segmentation Network. arXiv 2019, arXiv:1902.04502. [Google Scholar] [CrossRef] [Scilit]
  26. Yu, C.; Gao, C.; Wang, J.; Yu, G.; Shen, C.; Sang, N. BiSeNet V2: Bilateral Network with Guided Aggregation for Real-Time Semantic Segmentation. Int. J. Comput. Vis. 2021, 129, 3051–3068. [Google Scholar] [CrossRef] [Scilit]
  27. Liu, X.; Peng, H.; Zheng, N.; Yang, Y.; Hu, H.; Yuan, Y. EfficientViT: Memory Efficient Vision Transformer with Cascaded Group Attention. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Vancouver, BC, Canada, 17–24 June 2023; pp. 14420–14430. [Google Scholar] [CrossRef] [Scilit]
  28. Chen, L.C.; Zhu, Y.; Papandreou, G.; Schroff, F.; Adam, H. Encoder-Decoder with Atrous Separable Convolution for Semantic Image Segmentation. In Proceedings of the European Conference on Computer Vision (ECCV), Munich, Germany, 8–14 September 2018; pp. 801–818. [Google Scholar] [CrossRef] [Scilit]
  29. Ronneberger, O.; Fischer, P.; Brox, T. U-Net: Convolutional Networks for Biomedical Image Segmentation. In Proceedings of the 18th International Conference on Medical Image Computing and Computer-Assisted Intervention (MICCAI 2015), Munich, Germany, 5–9 October 2015; pp. 234–241. [Google Scholar] [CrossRef] [Scilit]
  30. Zhao, H.; Shi, J.; Qi, X.; Wang, X.; Jia, J. Pyramid Scene Parsing Network. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Honolulu, HI, USA, 21–26 July 2017; pp. 6230–6239. [Google Scholar] [CrossRef] [Scilit]
  31. Sun, K.; Xiao, B.; Liu, D.; Wang, J. Deep High-Resolution Representation Learning for Human Pose Estimation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Long Beach, CA, USA, 16–20 June 2019; pp. 5693–5703. [Google Scholar] [CrossRef] [Scilit]
  32. Woo, S.; Park, J.; Lee, J.Y.; Kweon, I.S. CBAM: Convolutional Block Attention Module. In Proceedings of the European Conference on Computer Vision (ECCV), Munich, Germany, 8–14 September 2018; pp. 3–19. [Google Scholar] [CrossRef] [Scilit]
  33. Hou, Q.; Zhang, L.; Cheng, M.M.; Feng, J. Strip Pooling: Rethinking Spatial Pooling for Scene Parsing. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Seattle, WA, USA, 13–19 June 2020; pp. 4003–4012. [Google Scholar] [CrossRef] [Scilit]
Figure 1. Typical samples and diverse background scenarios of UTOSD: (a) grasslands; (b) bare soil; (c) snow-covered areas; (d) oilfield facilities.
Figure 1. Typical samples and diverse background scenarios of UTOSD: (a) grasslands; (b) bare soil; (c) snow-covered areas; (d) oilfield facilities.
Applsci 16 08458 g001
Figure 2. Architecture of the improved Fluid-SegFormer model.
Figure 2. Architecture of the improved Fluid-SegFormer model.
Applsci 16 08458 g002
Figure 3. The structure of the LNG module.
Figure 3. The structure of the LNG module.
Applsci 16 08458 g003
Figure 4. The structure of the HVPA module.
Figure 4. The structure of the HVPA module.
Applsci 16 08458 g004
Figure 5. The structure of the FSBRD.
Figure 5. The structure of the FSBRD.
Applsci 16 08458 g005
Figure 6. Visualization results of various methods on the terrestrial oil spill dataset: (a) vegetation shadow occlusion; (b) bare-soil texture interference; (c) highly heterogeneous surfaces with oilfield facility interference; (d) ditch-constrained oil spill propagation; (e) hay and muddy-water interference; (f) highly cluttered background.
Figure 6. Visualization results of various methods on the terrestrial oil spill dataset: (a) vegetation shadow occlusion; (b) bare-soil texture interference; (c) highly heterogeneous surfaces with oilfield facility interference; (d) ditch-constrained oil spill propagation; (e) hay and muddy-water interference; (f) highly cluttered background.
Applsci 16 08458 g006
Table 1. Experimental running software configuration and hardware configuration.
Table 1. Experimental running software configuration and hardware configuration.
ParameterConfiguration
PyTorch2.1.2
Python3.10
CUDA12.1
GPUNVIDIA GeForce RTX 4070 Ti
CPUIntel Core i7-8700K
MMSegmentation1.2.2
Operating SystemWindows 10
Table 2. Comparative experimental results of different models on the UTOSD. All class-specific metrics (IoU, Precision, Recall, and F1-score) are reported for the oil spill class.
Table 2. Comparative experimental results of different models on the UTOSD. All class-specific metrics (IoU, Precision, Recall, and F1-score) are reported for the oil spill class.
MethodBackbonemIoU
(%)
IoU
(%)
Precision
(%)
Recall
(%)
F1
(%)
Params
(M)
Flops
(G)
FPS
(img/s)
U-NetU-Net84.0370.6884.1481.5482.8228.992033.06
PSPNetResNet-5086.4275.0884.8786.6885.7746.601798.01
DeepLabV3+MobileNetV282.1067.2181.179.6880.395.3423.8220.32
HRNetHRNet-1883.6169.8088.0277.1382.229.6418.5717.79
FastSCNNFastSCNN76.3557.0969.9175.6972.691.3980.926100.95
BiSeNetV2BiSeNetV277.1758.3674.3373.0973.713.3412.2854.17
SegformerMiT-B082.9375.9886.3886.3286.353.727.8816.24
OursMiT-B087.8477.5691.4283.6587.364.197.9613.76
Table 3. Comparison of different loss functions for Fluid-SegFormer.
Table 3. Comparison of different loss functions for Fluid-SegFormer.
LossmIoU
(%)
IoU
(%)
Precision
(%)
Recall
(%)
F1
(%)
BCE87.8477.5691.4283.6587.36
Focal Loss80.3563.7090.3268.3677.82
Table 4. Results of ablation experiments on the terrestrial oil spill dataset (√ indicates the improved module is adopted, while - means the improved module is not used).
Table 4. Results of ablation experiments on the terrestrial oil spill dataset (√ indicates the improved module is adopted, while - means the improved module is not used).
BaselineLNGHVPAFSBRDmIoU
(%)
IoU
(%)
Precision
(%)
Recall
(%)
F1
(%)
Params
(M)
Flops
(G)
FPS
(img/s)
---82.9375.9886.3886.3286.353.727.8816.24
--86.9075.8788.8583.8586.283.747.8914.46
--87.2976.5889.4484.1986.734.187.9016.28
--87.7277.4088.3186.2487.263.727.9315.42
-87.5977.1190.8183.6387.074.197.9114.43
87.8477.5691.4283.6587.364.197.9613.76
Table 5. Prediction results obtained with different decision thresholds.
Table 5. Prediction results obtained with different decision thresholds.
ThresholdmIoU
(%)
IoU
(%)
Precision
(%)
Recall
(%)
F1
(%)
0.2587.6177.2785.0489.4287.18
0.3087.9877.9187.1188.0687.58
0.3588.1178.1188.8386.6287.71
0.4088.0377.9490.1985.1687.6
0.4587.8477.5691.4283.6587.36
Table 6. Comparison of results of different models on the port dataset.
Table 6. Comparison of results of different models on the port dataset.
MethodmIoU
(%)
IoU
(%)
Precision
(%)
Recall
(%)
F1
(%)
U-Net79.0275.8578.0196.4786.26
PSPNet75.6272.075.5393.0183.72
DeepLabV3+72.8870.181.198.0482.42
HRNet73.2369.5473.3193.182.03
Segformer85.181.8487.3892.8190.01
Ours85.2482.1186.7493.990.18
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Shao, K.; Cao, H. A Lightweight Semantic Segmentation for Terrestrial Oil Spill Detection. Appl. Sci. 2026, 16, 8458. https://doi.org/10.3390/app16178458

AMA Style

Shao K, Cao H. A Lightweight Semantic Segmentation for Terrestrial Oil Spill Detection. Applied Sciences. 2026; 16(17):8458. https://doi.org/10.3390/app16178458

Chicago/Turabian Style

Shao, Keyong, and Honglian Cao. 2026. "A Lightweight Semantic Segmentation for Terrestrial Oil Spill Detection" Applied Sciences 16, no. 17: 8458. https://doi.org/10.3390/app16178458

APA Style

Shao, K., & Cao, H. (2026). A Lightweight Semantic Segmentation for Terrestrial Oil Spill Detection. Applied Sciences, 16(17), 8458. https://doi.org/10.3390/app16178458

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop