# Video Interpolation-Based Multi-Source Data Fusion Method for Laser Processing Melt Pool
## 3 A Method for Multi-Source Data Fusion Based on Video Frame Interpolation
### Infrared and Visible Image Fusion Network Model
First, the input is divided into \(M\times M\) non-overlapping local windows using the shifted-window mechanism, and features of size \(H\times W\times C\) are reshaped into features of size \(\frac{HW}{M^{2}}\times M^{2}\times C\), generating a total of  
Figure 4: Image fusion network model. \(\frac{HW}{M^{2}}\) windows. Then, the reshaped features are projected to obtain \(Q\) (query), \(K\) (key), and \(V\) (value). \[\{Q,K,V\}=\left\{XW^{Q},XW^{K},XW^{V}\right\} \tag{8}\]  
where \(X\in\mathbb{R}^{M^{2}\times C}\) represents the local window feature, while \(W^{Q}\in\mathbb{R}^{C\times C}\), \(W^{K}\in\mathbb{R}^{C\times C}\), and \(W^{V}\in\mathbb{R}^{C\times C}\) are learnable weight matrices. The formula for the attention mechanism is as follows:  
\[Attention(Q,K,V)=SoftMax\Big{(}\frac{QK^{T}}{\sqrt{d_{k}}}\Big{)}V \tag{9}\]  
where \(d_{k}\) is the dimension of the key and \(SoftMax(\bullet)\) is the softmax function used to calculate the attention weights. The FFN consists of two multi-layer perceptrons (MLPs) and a GELU activation function, with layer normalization (LN) performed after each MSA and FFN. Additionally, residual connections are applied within both modules. The expressions for the intra-domain fusion unit are as follows:  
\[ \begin{array}{l}Z^{l-1}=\{Q,K,V\},\\ \bar{Z}^{l}=LN\Big{(}W-MSA\Big{(}Z^{l-1}\Big{)}\Big{)}+Q,\\ Z^{l}=LN\Big{(}FFN\Big{(}\bar{Z}^{l}\Big{)}\Big{)}+\bar{Z}^{l}\end{array}  \tag{10}\]  
The cross-attention-based inter-domain fusion unit is designed to further integrate global interactions between different domains, where the inter-domain fusion unit uses Multi-Head Cross-Attention (MCA) instead of MSA to achieve global context exchange across domains. The inter-domain fusion unit is defined as follows:  
\[ \begin{array}{l}\bar{Z}_{1}^{l-1}=\{Q_{1},K_{2},V_{2}\}=\left\{X_{1}W_{1}^{ Q},X_{2}W_{2}^{K},X_{2}W_{2}^{V}\right\},\\ \bar{Z}_{2}^{l-1}=\{Q_{2},K_{1},V_{1}\}=\left\{X_{2}W_{2}^{Q},X_{1}W_{1}^{K},X_ {1}W_{1}^{V}\right\},\\ \bar{Z}_{i}^{l}=LN\Big{(}W-MCA\Big{(}\bar{Z}_{i}^{l-1}\Big{)}\Big{)}+Q_{i},\\ Z_{i}^{l}=LN\Big{(}FFN\Big{(}\widetilde{Z}_{i}^{l}\Big{)}\Big{)}+\bar{Z}_{i}^{ l},i\in\{1,2\}\end{array}  \tag{11}\]  
The shifted-window mechanism of the Swin Transformer layer is shown in Figure 5. At layer \(i\), a regular window configuration is used. At layer \(i+1\), the window partitions are cyclically shifted \(\Big{(}\Big{\lfloor}\frac{M}{2}\Big{\rfloor},\Big{\lfloor}\frac{M}{2}\Big{ \rfloor}\Big{)}\) pixels to the upper left, ensuring communication and connection across windows. After the ACFM module, a convolutional layer is used to aggregate information from different domains and serves as the input to the reconstruction module. The reconstruction module, composed of four Swin Transformer layers, three convolutional layers, and two Leaky ReLU activation functions, is responsible for reconstructing the image from a global  
Figure 5: Schematic diagram of the shifted-window mechanism in Swin Transformer layers. perspective and generating the fused image. The kernel size of the convolutional layers in the reconstruction module is \(3\times 3\), with a stride of 1. To ensure that the fused image retains sufficient structural and textural features and to adjust the intensity, the weighted sum of SSIM loss (\(L_{\text{ssim}}\)), texture loss (\(L_{text}\)), and intensity loss (\(L_{int}\)) is used as the overall loss function, and its formula is as follows:  
\[L\Big{(}I_{f},I_{1},I_{2}\Big{)}=10L_{\text{ssim}}\Big{(}I_{f},I_{1},I_{2} \Big{)}+20L_{text}\Big{(}I_{f},I_{1},I_{2}\Big{)}+20L_{int}\Big{(}I_{f},I_{1},I _{2}\Big{)} \tag{12}\]  
SSIM loss (\(L_{\text{ssim}}\)) is composed of the loss function of the MTVFI model, and the formula is as follows:  
\[L_{\text{ssim}}\Big{(}I_{f},I_{1},I_{2}\Big{)}=0.5\Big{(}1-L\Big{(}I_{f},I_{1} \Big{)}\Big{)}+0.5\Big{(}1-L\Big{(}I_{f},I_{2}\Big{)}\Big{)} \tag{13}\]  
Texture loss is used to preserve and aggregate the textural details of the source images.