# Fish Body Pattern Style Transfer Based on Wavelet Transformation and Gated Attention
## 4 Experiments
### Comparison  
#### 4.3.1 Fish Body Instance Segmentation  
We trained our ornamental fish dataset on multiple instance segmentation models, and the quantitative comparison results are presented in Table 1. During training, Mask2 Former achieved its best fish segmentation performance at 17,000 iterations, recording an IoU of 94.81% and a dice coefficient of 97.32%. As Mask2 Former is based on a transformer architecture and employs dynamic mask prediction, along with multi-head attention and multi-scale feature enhancement, the experimental results demonstrate that it has significant advantages when segmenting small objects, such as fish. Therefore, we selected Mask2 Former as our primary instance segmentation model.  
As shown in Figure 9a, we compared the segmentation results of different models on the goldfish dataset. The first column represents input video frames, while columns two to five show the segmentation predictions from different models. The selected images contain overlapping fish, as well as partially occluded or disappearing and reappearing objects. Compared to the other models, Mask2 Former effectively handles these challenges, accurately segmenting fish instances, even in complex occlusion scenarios. Additionally,  
Figure 8: Example of the goldenfish segmentation dataset. (**a**) shows the real goldenfish vedio frames; (**b**) shows the mask corresponding to the frame.  
Figure 9b highlights the segmentation of goldfish tails, demonstrating that Mask2 Former achieves more precise extraction in cases where tail segmentation is typically challenging.  
Figure 10 illustrates a comparison of localized style transfer images based on different segmentation masks. In areas where the fish's edges are difficult to distinguish from the background, K-Net and Mask2 Former yield different results. In Figure 10c, which shows the method using K-Net, there is style blending of the background and foreground in the regions where fish tails overlap with multiple fish bodies. In contrast, the image based on Mask2 Former, as shown in Figure 10d, accurately captures complex boundaries, achieving clear style separation between the fish and the background while preserving the texture details of the content image.  
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Model** & **IoU \(\uparrow\)** & **Acc \(\uparrow\)** & **Dice \(\uparrow\)** & **Precision \(\uparrow\)** & **Recall \(\uparrow\)** \\ \hline Deeplabv3+ [32] & 94.46 & 96.26 & 97.15 & 97.69 & 96.30 \\ K-Net [33] & 94.78 & 96.12 & 97.32 & 97.58 & 96.12 \\ Fast-SCNN [34] & 83.65 & 86.23 & 86.78 & 87.04 & 86.23 \\ Mask2 Former [4] & **94.81** & **96.59** & **97.33** & **98.07** & **96.59** \\ \hline \hline \end{tabular}
\end{table}
Table 1: Segmentation index of the fish body by different models. The symbol “\(\uparrow\)” indicates that a higher value is preferable; the best-performing results are highlighted in bold.  
Figure 9: Mask effects of different segmentation models. (**a**) is the input video frame and the generated mask, while (**b**) is the detail comparison between K-net and Mask2 Former.  
Although the model was specifically designed with stability for long-sequence processing in mind, during actual operation, we observed that when the fish body makes large movements within a short period, occasional color drifts occur. These drifts lead to the loss of texture in the stylized images, adversely affecting certain video frames. The primary challenges encountered during long-sequence video testing include the model's difficulty in adapting to rapidly moving fish and the occurrence of flickering stylization effects caused by underwater disturbances, such as seagrass and oxygenation bubbles. These factors can lead to occasional segmentation errors, affecting the overall quality of the stylized video. Figure 11 illustrates this phenomenon: