## 3 Method
### Our Method  
Deep CORAL model was built using AlexNet in which convolutional layers are inefficient for modeling global dependencies in images due to its local view. We adapted the attention mechanism to overcome the shortcoming of AlexNet, enabling the image features extracted by convolutional layers to be able to provide more representative information. We call the proposed method P-norm Attention Deep CORAL (P-ADC) because of the added attention mechanism (see Figure 2). Figure 1: The architecture of Deep CORAL. \(\phi\) denotes any deep neural network (e.g., AlexNet). The 256 * 6 * 6 denotes the size of the features maps extracted by AlexNet; the 256 stands for the number of channels, and 6 * 6 is the weight * height of a single feature map. Suppose image features \(X=\{x_{1},x_{2},\cdots,x_{N}\}\) are provided from the previous layer where \(x_{i}\in\mathbb{R}^{C\times W\times H}\) are the image features of each sample. Note that \(C\) denotes the number of channels, and \(W,H\) is the width and height of the image features \(x\). Then, the energy of \(x_{i}\) is expressed as follows:  
\[\dot{s}_{j,k}^{i}=\sum_{l=1}^{C}v_{j,l}^{i}t_{l,k}^{i},v^{i}=\left(W_{V}x_{i} \right)^{\prime},t^{i}=\tanh\bigl{(}\left(W_{K}x_{i}\right)+\left(W_{Q}x_{i} \right)\bigr{)} \tag{4}\]  
where \(W_{V}\in\mathbb{R}^{C\times C}\),\(W_{K}\in\mathbb{R}^{C\times C}\),\(W_{Q}\in\mathbb{R}^{C\times C}\) are the learned weight matrices, which belong to the convolutional layer with kernel_size = 1, stride = 1, and padding = 0. \(C\) is the number of channels. Here, we can reduce the channel number \(C\) to \(\frac{C}{\mathbb{I}}\)[11], where \(k\) = 8 was chosen in our experiment to reduce the number of parameters while not decreasing the performance significantly. \(v^{i}\) and \(t^{i}\) are two different feature spaces calculated with the image feature map \(x_{i}\) of the previous hidden layer. \(s^{i}\) means the energy of \(x_{i}\). \(j\) and \(k\) indicate the position coordinates of the energy \(s^{i}\) of the ith image sample. Attention mechanisms [12, 13] have been employed successfully in sequence modeling and transduction problems such as speech recognition, neural captioning, etc., to tackle capturing long-range interactions for convolutions. Recently, attention mechanisms have also been applied in computer vision models to provide contextual information. The essence of the attention mechanism is actually an addressing process: Given a query vector  
Figure 2: The architecture of P-ADC. \(\oplus\) denotes the stack operation. For example, if the size of \(a\) and \(b\) is \(256\times 6\times 6\), respectively, then the size of \(a\oplus b\) should be \(512\times 6\times 6\). \(\otimes\) is the addition operation, i.e., classification loss \(+\) p-norm loss. \(q\) related to the task and a key vector \(k\), the distribution values will be calculated by \(q\) and \(k\), and then, attach it to the value vector \(v\). The main attention models are as follows. \[\text{Additive model} s(q) =v^{T}tanh(Wk+Uq) \tag{5}\] \[\text{Dot-product model} s(q) =k^{T}q\] (6) \[\text{Scaled dot-product model} s(q) =\frac{k^{T}q}{\sqrt{d}}\] (7) \[\text{Bilinear model} s(q) =k^{T}Wq \tag{8}\]  
Equation (4) belongs to a kind of additive model. The attention matrices of \(x_{i}\) are given by:  
\[\alpha_{j,k}^{i}=\frac{e^{\left(s_{j,k}^{i}\right)}}{\sum_{k=1}^{M}e^{\left(s _{j,k}^{i}\right)}} \tag{9}\]  
where \(M=W\times H\) and \(\alpha^{i}\) denote the attention matrices of \(x_{i}\). Then, the output of the attention layer is:  
\[o_{j,k}^{i}=\sum_{l=1}^{M}v_{j,l}^{i}a_{k,l}^{i} \tag{10}\]  
where \(o^{i}\in\mathbb{R}^{C\times W\times H}\) is the output of the attention layer. According to [13], additive attention and dot-product attention are the most popular attention functions. Here, we also defined dot-product attention for the convenience of application. \(s_{j,k}^{i}=\sum_{l=1}^{C}v_{j,l}^{i}t_{l,k}^{i},v^{i}=(W_{V}x_{i})^{{}^{\prime }},i^{i}=W_{K}x_{i}\).