## 3 Attentive Octave Convolutional Capsule Network
### Attentive Octave Convolution Layer  
In the traditional convolution operation, the input information is processed by convolutional kernels of certain sizes. Convolution operations of different convolutional kernels can obtain information of different frequencies, and there is no effective fusion process between frequencies. The octave convolution operation [16] is proposed to process different frequencies simultaneously. In octave convolution, the convolution and fusion of two frequencies with a difference of an octave are performed simultaneously without an attention mechanism module. It is very important to select useful information in medical image classification. In order to select information of different frequencies, we add a CBAM [33] in the AOC-Layer. Suppose the input is defined as \(I\in R^{3\times h\times w}\), where \(h\) and \(w\) are defined as the height and width of the image. The feature maps obtained by the first convolution layer are defined as \(F\in R^{c\times h\times w}\), where \(c\) is the channel of the feature maps. In the AOC-Layer, the feature map \(F\) is first divided into two parts \(\left\{F_{1}^{H},F_{1}^{L}\right\}\) by a convolution operation (H-H Conv in Figure 1a) and pooling and a convolution operation (H-L Pooling and Conv in Figure 1a), where \(F_{1}^{H}\) is higher frequency and \(F_{1}^{L}\) is lower frequency. The channels of the feature maps are divided by ratio \(\alpha\). The size of the higher frequency is \(R^{ac\times h\times w}\) and that of the lower frequency is \(R^{(1-\alpha)c\times\frac{h}{2}\times\frac{w}{2}}\). In order to obtain lower-frequency information, two pooling operations (average and maximum) are used in the AOC-Layer. Their effects are discussed in detail in Section 4.5. In order to convert lower-frequency information into higher-frequency information, bilinear interpolation is used to convert lower-resolution feature maps into higher-resolution feature maps. Then, the higher- and lower-frequency communicate with each other by summation, as shown in Formulas (1) and (2):  
\[F_{2}^{H}=Conv_{H-H}(F_{1}^{H})+Upsample_{L-H}(Conv_{L-H}(F_{1}^{L})) \tag{1}\]  
\[F_{2}^{L}=Pooling_{H-L}(Conv_{H-L}(F_{1}^{H}))+Conv_{L-L}(F_{1}^{L}) \tag{2}\]  
Figure 1: Attentive octave convolution capsule network. (**a**) Attentive octave convolution layer. (**b**) Main framework of AOC-Caps. As shown in Figure 1a, the attention modules are added to the intermediate feature maps with different frequencies to enhance useful information and suppress useless information. Without losing particularity, an intermediate feature map in the AOC-Layer is defined as \(F^{{}^{\prime}}\in R^{C^{{}^{\prime}}\times H^{{}^{\prime}}\times W^{{}^{\prime}}}\), where \(C^{{}^{\prime}}\) is the number of channels of both higher- and lower-frequency parts, and \(H^{{}^{\prime}}\) and \(W^{{}^{\prime}}\) are the height and width of higher- and lower-frequency parts. The attention module sequentially infers a 1D channel attention map \(F^{{}^{\prime}}_{c}\in R^{C^{{}^{\prime}}\times 1\times 1}\) and a 2D spatial attention map \(F^{{}^{\prime}}_{s}\in R^{1\times H^{{}^{\prime}}\times W^{{}^{\prime}}}\). The selections of channel and spatial information are based on Formulas (3) and (4):  
\[F^{att}_{c}=F^{{}^{\prime}}_{c}(F^{{}^{\prime}})\otimes F^{{}^{\prime}} \tag{3}\]  
\[F^{att}_{s,c}=F^{{}^{\prime}}_{s}(F^{att}_{c})\otimes F^{att}_{c} \tag{4}\]  
where \(\otimes\) denotes the element-wise multiplication. The intermediate feature map \(F^{{}^{\prime}}\in R^{C^{{}^{\prime}}\times H^{{}^{\prime}}\times W^{{}^{ \prime}}}\) is firstly processed by a channel attention module. The feature map \(F^{{}^{\prime}}\) is pooled along the spatial dimension through average and maximum operations. The average-pooled features and max-pooled features are processed by a multi-layer perception (MLP), with one hidden layer for producing the channel attention vector \(F^{{}^{\prime}}_{c}\in R^{C^{{}^{\prime}}\times 1\times 1}\).