# Audio Anti-Spoofing Based on Audio Feature Fusion
## 2 Methods
### Feature Fusion
Firstly, the input audio feature (T, F) (denoted as \(X_{T}\)) was linearly transformed into the corresponding \(QKV\), marked as \(Q_{f}\), \(K_{f}\), and \(V_{f}\), by multiplying with the weight matrix, \(W_{t}\). Meanwhile, the audio feature was transposed to (F, T) (denoted as \(X_{F}\)) and similarly linearly transformed into \(Q_{t}\), \(K_{t}\), and \(V_{t}\) using the weight matrix, \(W_{f}\):  
\[(Q,K,V)=X\times(W_{q},W_{k},W_{v}) \tag{4}\]  
where \(X\) represents the input audio feature matrix (including \(X_{T}\) and \(X_{F}\)), and \(W\) represents the corresponding weight matrix (including \(W_{T}\) and \(W_{F}\)). The modified attention mechanism was then applied for feature fusion. To better integrate the timeframe and feature dimension information, a transformation, as shown in Figure 3, was applied to the \(V\) in each set of \(Q\), \(K\), and \(V\). \(V\) was input into a one-dimensional convolution, Conv1d. After passing through BatchNorm and GELU functions, it was passed through another one-dimensional convolution, Conv1d, to obtain the output, \(V^{\prime}\). Finally, we obtained the matrix \(V\) required by the attention mechanism by performing a dot product between the transpose of \(V^{\prime}\) and the \(V\) in another set of \(QKV\). The required attention matrix was obtained by inputting the obtained \(V\) and the corresponding \(Q\) and \(K\) into the attention formula, denoted as \(a_{t}\) and \(a_{f}\), corresponding to the input \(X_{T}\) and \(X_{F}\), respectively. Meanwhile, for the weight matrix, \(W\), used in linear transformation, the following operations were performed:  
(a) The size of the weight matrix \(W_{T}\) corresponding to \(X_{T}\) was (T, T). After linear transformation, \(W_{T}\) with a size of (T, 1) was obtained. Therefore, the three weight matrices, \(W_{T,A}\), \(W_{T,k}\), and \(W_{T,\
u}\), corresponding to \(X_{T}\), were obtained as \(W_{T,A}\), \(W_{F,k}\), and \(W_{F,\
u}\), corresponding to respectively. Similarly, the three weight matrices, \(W_{F,A}\), \(W_{F,k}\), and \(W_{F,\
u}\), corresponding to \(X_{F}\), were obtained as \(W_{F,A}^{\prime}\), \(W_{F,k}^{\prime}\), and \(W_{F,\
u}^{\prime}\):  
\[ \begin{bmatrix}w_{1,1}&\dots&\dots&\dots&w_{1,T}\\ \vdots&\ddots&&\vdots\\ \vdots&&\ddots&&\vdots\\ \vdots&&\ddots&\vdots\\ w_{T,1}&\dots&\dots&\dots&w_{T,T}\\ \end{bmatrix}\begin{bmatrix}a_{1}\\ \vdots\\ \vdots\\ \vdots\\ a_{T}\end{bmatrix} = \begin{bmatrix}w_{1}\\ \vdots\\ \vdots\\ \vdots\\ w_{T}\end{bmatrix}  \tag{5}\] \[ \begin{bmatrix}w_{1,1}&\dots&\dots&\dots&w_{1,F}\\ \vdots&\ddots&&\vdots\\ \vdots&&\ddots&\vdots\\ w_{F,1}&\dots&\dots&\dots&w_{F,F}\\ \end{bmatrix}\begin{bmatrix}b_{1}\\ \vdots\\ \vdots\\ b_{F}\end{bmatrix} = \begin{bmatrix}w_{1}\\ \vdots\\ \vdots\\ \vdots\\ w_{F}\end{bmatrix} \]  
Figure 3: We fused \(V\) from two different sets of \(QKV\) and used the fused \(V^{\prime}\) for multi-attention. We also use the weights at linear transformation as input to the third multi-attention and its output as additional information. (b) \(W^{\intercal}_{T,q}\) and \(W^{\prime}_{F,q}\) were multiplied to obtain the matrix \(Q_{s}\) of size (T, F). Similarly, \(K_{s}\) and \(V_{s}\) were obtained:  
\[ \begin{bmatrix}wt_{1}\\ \vdots\\ w_{T}\end{bmatrix} [wt_{1}\quad\ldots\quad w_{F}]= \begin{bmatrix}wt_{1,1}& \ldots&\ldots&w^{\prime}_{1,F}\\ \vdots&&&\vdots\\ wt_{T,1}&\ldots&\ldots&w\prime_{T,F}\end{bmatrix}  \tag{6}\]  
(c) The attention calculation was performed on \(Q_{s}\), \(K_{s}\), and \(V_{s}\) to obtain the corresponding matrix \(a_{s}\):  
\[a_{s}=\text{Multihead}(Q_{s},K_{s},V_{s}) \tag{7}\]  
Finally, three attention matrices, \(a_{t},a_{f}\), and \(a_{s}\), were obtained, and the transpose matrix of \(a_{t}\) was dot-multiplied with \(a_{f}\), and the result was then added to \(a_{s}\) to obtain the final output matrix:  
\[\text{attention}=(a_{f}\times{a_{t}}^{T}+a_{s}) \tag{8}\]