# Detection of Marine Oil Spill from PlanetScope Images Using CNN and Transformer Models
## 5 Discussion  
To date, optical satellite images have rarely been used for deep learning-based detection of marine oil spills. Furthermore, objective comparisons between CNN and Transformer models for oil spill detection are lacking. In this study, we used high-resolution optical satellite images to compare the performance of DeepLabV3+, Swin-UPerNet, and Mask2 Former, which are representative models for CNN and Transformer architectures, respectively. Figures 5-9 demonstrate that all the models are capable of detecting the location and shape of oil spills. Table 4 shows that DeepLabV3+, Swin-UPerNet, and Mask2 Former achieved high scores across evaluation metrics such as mIoU, accuracy, precision, recall, F1 score, and Kappa coefficient. Notably, the mIoU performance indicates that all models can effectively detect marine oil spills, highlighting its importance as a critical evaluation metric in semantic segmentation. Additionally, the similar precision and recall values suggest that there was no significant tendency for overestimation or underestimation. The five-fold cross-validation yielded consistent results across each fold, indicating that the models are relatively stable, with minimal risk of overfitting or bias. However, the quantitative and qualitative results indicate that the Swin-UPerNet and Mask2 Former models, both utilizing the Transformer backbone, outperform DeepLabV3+,  
Figure 9: Randomly selected examples from fold 5, including PlanetScope RGB images, segmentation labels, and predictions from DeepLabV3+ (DL), Swin-UPerNet (Swin), and Mask2 Former (M2F). although detecting oil spills with non-uniform shapes and spectral patterns remains challenging. When the proportion of the oil spill class in the image was larger, all the models were able to detect oil spills stably. However, when the proportion of the oil spill was small, DeepLabV3+ occasionally failed to detect it, whereas both Swin-UPerNet and Mask2 Former consistently and reliably identified these spills. This suggests that models utilizing the Transformer backbone are more suitable for oil spill detection due to their attention mechanism, which enables more effective feature mapping, despite a slightly higher computational resource requirement. Additionally, the architecture of Transformer models enables them to retain fine details in edge areas. In CNN-based models, edges often become smoothed during the convolution and pooling processes used for downsampling, as these operations tend to blur spatial boundaries when the image resolution decreases. However, the attention mechanisms in Swin-UPerNet and Mask2 Former allow these models to capture and preserve local details, making them more effective at delineating the intricate borders of oil spills. Their scale adaptability ensures both global context awareness and fine-grained spatial attention. This ability to represent detailed edges in Transformer models is especially beneficial in cases like oil spills, where complex, irregular boundaries are common. Both Transformer models, Swin-UPerNet and Mask2 Former, outperformed the CNN-based DeepLabV3+ model. In particular, Swin-UPerNet consistently showed better performance than Mask2 Former in our experiment. This may be because (1) the shifted-window (Swin) self-attention mechanism effectively captures both global and local features; (2) the UPerNet model employs pyramid pooling to combine multi-scale features effectively and incorporates a head structure for detailed binary delineation, whereas Mask2 Former is optimized for instance segmentation; and (3) Swin-UPerNet's simpler design, compared to Mask2 Former, enables better performance under constrained computing resources. Despite the advantages of optical satellite images, there are still some limitations. For instance, optical satellite images can be obscured by clouds, making it challenging to collect a diverse range of oil spill cases that account for variations in color and thickness based on the characteristics of the oil spills.