{'fraction_non_alphanumeric': 0.025485743123896037, 'fraction_numerical': 0.00812515770880646, 'mean_word_length': 5.017613118736715, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
ME-CapsNet: A Multi-Enhanced Capsule Networks with Routing Mechanism

Convolutional Neural Networks need the construction of informative features, which are determined by channel-wise and spatial-wise information at the network's layers. In this research, we focus on bringing in a novel solution that uses sophisticated optimization for enhancing both the spatial and channel components inside each layer's receptive field. Capsule Networks were used to understand the spatial association between features in the feature map. Standalone capsule networks have shown good results on comparatively simple datasets than on complex datasets as a result of the inordinate amount of feature information. Thus, to tackle this issue, we have proposed ME-CapsNet by introducing deeper convolutional layers to extract important features before passing through modules of capsule layers strategically to improve the performance of the network significantly. The deeper convolutional layer includes blocks of Squeeze-Excitation networks which use a stochastic sampling approach for progressively reducing the spatial size thereby dynamically recalibrating the channels by reconstructing their interdependencies without much loss of important feature information. Extensive experimentation was done using commonly used datasets demonstrating the efficiency of the proposed ME-CapsNet, which clearly outperforms various research works by achieving higher accuracy with minimal model complexity in complex datasets.


I. INTRODUCTION
Convolutional Neural Network (CNN) is a cutting-edge image classification [1]- [3] approach that excels in detecting characteristics but struggles to grasp the spatial connection between them, such as their direction, perspective, and size. For scene understanding or any vision-based strategy, improving categorization accuracy is critical. In addition, transmitting information from one layer to the next (Routing) is less efficient in CNNs. This may be improved by identifying important characteristics using a variety of representations and building well-organized routing strategies for transferring data between layers. Investigation of many elements of network architecture (spatial, channel) is now a very prominent research subject in CNN, and it may greatly improve the network's understanding ability [4].
Capsule Networks (CapsNet) where introduced by Sabour et al. [5] to solve the common issues with CNNs (rotational invariance and failure to capture spatial hierarchical information) by fetching most important feature information and spatial relationship efficiently. Instead of pooling operations, dynamic routing was adapted to prevent losing important features. Also, capsules where used instead of neurons thereby passing the spatial relationship from one layer to next efficiently. But, CapsNet tends to fail as a result of more feature information in complex datasets. Thus, adding of deeper convolutional layers to the CapsNet in a strategic way is one approach to solve this issue.
Thus, we are proposing a novel network called Multi-Enhanced Capsule Networks (ME-CapsNet) which finds robust features, obtaining good channel and spatial relationships between layers. Squeeze-Excitation network or SENets [6] with very little computation difference, models the interconnection of channels by adaptively recalibrating the channel features. Once the important features are learnt, the likelihood and the properties of each and every feature are estimated by passing it to the CapsNet module which inturn uses EM Routing to prevent feature losses. EM Routing [7] is used to group capsules with the parent capsule using the closeness in the proximity of the corresponding estimated votes on the pose matrix. Also, reconstruction is included in the proposed work, unlike the originally proposed CapsNet with EM Routing.
Some contributions of this research work are mentioned here as follows: • A novel network which multi enhances the features, that is, both spatial and channel-wise information at each layer with deep convolutional layers (SENets) and CapsNet; Fig. 2. Overall architecture of ME-CapsNet • Improvements in the Squeeze phase of the originally proposed SENets by using Stochastic Spatial Sampling Pooling (S3P) to reduce feature information losses, computation overload and tranining time when compared to the originally used average pooling operation. • Exploring the capabilities of the proposed system by fusing it with several state-of-the-art base models including ResNet, VGG, Inception and MobileNet and analyzing the performance of the proposed network by calibrating with different parameters. The rest of the research paper is systematized as follows: Section II consists of the related research works relating to various networks pertaining to SENets and CapsNets followed by Section III detailing the proposed architecture along with its modules. Then in Section IV, various experimentation is done testing by tweaking parameters and in Section V the proposed architecture is tested with various state-of-the-art datasets and networks. Also, few predominantly efficient networks were handpicked and tested alongside our network. Finally, in Section VI the proposed architecture is summarized with its advantages and is followed by future works premeditated to increase the robustness of the currently proposed system.

II. RELATED WORKS
Since the introduction of deep convolutional networks [8] significant improvement in the deep learning regime has been witnessed. Stacking of layers as a result of deep networks significantly improved the performance but also introduced vanishing gradient problems [9]. Also, using operating layers like max pooling introduced loss of spatial information. Cap-sNet attempts to solve these issues by nesting layers instead of stacking them. These recent techniques in deep learning, added fuel to research in this field drastically.
CapsNet are considered a great leap into the neural networks considering its significance and scope of improvement over the traditional techniques. Some efficient research works on CapsNet are explained here. Mazzia et al. [10] proposed a non-iterative routing technique that exploits self-attention mechanisms. Deliege et al. [11] introduced a counterpart for DigitCaps layer using a custom Hit-or-Miss layer. Huang et al. [12] proposed addition of two attention layers to the original CapsNet, to improve the overall performance of the network.
SENets are predominantly used recently considering the significant improvement in performance with minimal amount of computation rise. A lot of customization to SENets have also been done, including Yue Cao et al. [13] performing a unification of NLnet and SENet resulting in a Global Context (GC) network. A lot of SENets applications has been established including some works by Qiu et al. [14], Shunjun Wei et al. [15], and Han et al. [16] where fusion of SENets were done with various architectures of CNN for fish image classifications, PRI modulation recognition, sea ice image sensing respectively.
Yang et al. [17] proposes an approach to enhance the feature extraction capability of CapsNet using a modified version of ResNet called Res2Net and SENet in the base layers to enhance the performance of the CapsNet. This is the closest work in relavance to our work. We have strategically employed the SE blocks in between various layers and used a more powerful variant of pooling to improve the performance of the squeeze operation.

III. METHODOLOGY
In this section, the different components equipped by our work to complete the robust architecture is discussed extensively. Our architecture predominantly has three blocks to multi-enhance the feature relationship of CNN: the SE Primary Capsule (SE-PC) block, SE Classification Capsule (SE-CC) block and the Mask by Layer (MbL) block. That is, an input image in form of tensor (U) is fed to our network, which first converts into a tensor upon transformation (U tr ). Then, U tr is sent through the the SE-PC block wherein Squeeze and Excitation operation is done which results in U o tr which has recalibrated weights based on channel dependence. U o tr is then passed through the primary capsule layer. The Squeeze and Excitation operation is done three times continuously to get the improved calibrated weights for the corresponding channels. The Squeeze operation is done using S3P [18] which will be explained in Section III-A. Then the output of the primary layer of the SE-PC is fed as input to the SE-CC wherein features are highlighted using SENets first and then is sent to the classification module. Then, we designed the MbL block inspired by the works for Huang et al. [19] for reconstructing the output capsules from the probabilty vectors obtained from the SE-CC block. Advantages of including the reconstruction block include regularization and ability to regenerate data.

A. Squeeze-Excitation Network
SENets directly influence the performance of the network and its layers through adaptive adjusting of the weights ob-tained from each and every feature map in the channels of the convolutional block by adding supplementary parameters. This interfacing with weights radically increases the sensitivity to beneficial features in the map which will be exploited in succeeding transformations.
GMP (represented as z max in equation 2) extracts low-level features (edges, textures) better than GAP but captures a lot of noise and is independent of neighboring pixels.
In this work, we will be using a pooling approach proposed by Zhai et al. [18]. A two step process including GMP (z max ) and stochastic down sampling (D s g (.)) is done on the feature map to learn better abstract representations in a larger receptive field. Considering it is stochastic, different feature map is obtained for the same training sample. This means it performs a virtual data augmentation [20]. Equation 3 defines the S3P pooling, where s represents strides and g represents the grid size.
Now, the output of the squeeze phase (z m ix) is passed to the excitation phase for adaptive scaling of weights in the respective channel. Excitation is done using the Multi-Layer Perceptron (MLP) approach. That is, two fully connected layers are used with weights W 1 and W 2 . The first fully connected layer is connected to ReLU activation [21] followed by another fully connected layer, which in turn is connected to the Sigmoid activation function. This can be represented as shown in equation 4. While training, W 1 and W 2 are learned.
In other words, channel-wise dependence is found inside the excitation phase by learning the weights, W 1 and W 2 using a compression ratio to enable efficient learning. Figure 3 shows the schema of the SENet with the Residual Network (ResNet) backbone leveraged in this work. In other words, the output of figure 3 is the input of the primary capsule layer. A very similar architecture without ResNet, leveraging the output of capsule layers are used for the SENets equipped before the classification capsule layer.

B. Capsule Network
Appropriate activation can be given if the likeliness of the feature and the feature information is passed via each and every neuron. Thus, these neurons are termed capsules and they output a vector (called an activity vector) instead of single feature information. Knowing the likeliness of a feature, we can easily extrapolate different feature variants in a capsule, thereby reducing the training data. The product of the pose matrix (M i ) represented by a gaussian distribution with the transformation (W ij ) is computed to calculate the vote (v ij ).
In equation 5, i corresponds to the parent capsule and j to the current capsule. The transformation is learned through back-propagation and a cost function.

C. Routing Mechanism
Transferring information from one layer to another is called Routing. ReLU is used as the routing mechanism in fully convolutional neural networks.
Instead of ReLU, a squashing function is used to convert small vector magnitudes to zero and big vector magnitudes to unit vectors. Grouping of capsules using the EM clustering technique is called EM Routing. Parent capsules are predicted in the pose matrix in terms of 'votes'. It is based on proximity, so even when the viewpoints change, the transformation matrix remains constant. Assignment probabilities (r ij ) estimate the runtime connection with respect to the parent and other capsules. The cost of all low-level capsules is shown in equation 7.
Activation (A j ) in a particular capsule can be estimated using the inverse temperature parameter (λ) and parameters iteratively estimated using EM Routing by equation 8.
The data points fit into a gaussian model and E and M steps are triggered alternatively iterating for 't' steps. The Gaussian model is updated using the M step based on the r ij initialized (distributed uniformly) which will then be reshaped to form the pose matrix of the parent capsule. The r ij is recomputed using the E-step for every data point.
Upon the completion of EM Routing, the capsules with best activation is selected to make the appropriate predictions using the MLP approach used in the excitation phase of the SE Blocks of ME-CapsNet.

D. Reconstruction
The output of the classification capsule is used for reconstruction of the input image by passing through a decoder. The output is a vector which consists the probability vector squashed to get values between 0 to 1. The idea behind the used non-linear squashing function is to compress small vectors to zero and long vectors to one. The decoder network consists of two fully connected layers with ReLU activation and a sigmoid function. Mean Square Error (MSE) is used for estimating the reconstruction loss between true (y) and predicted (y 0 ) labels as shown in equation 9.
IV. EXPERIMENTATION In this section, experiments are steered from the architecture proposed in the previous section using MNIST, FashionM-NIST and CIFAR-10 datasets, and the performance is evaluated with respect to other networks, previous effective research works and parameter tuning.
Implementation of ME-CapsNet is done using several tuned parameters for efficient training and some important parameters are mentioned below. We have built ME-CapsNet using Keras and tensorflow framework. Tensorboard visualization toolkit was used for analyzing the performance of the proposed network. The network was compiled using the NVIDIA GTX 1650 GPU. The dataset was publicly available for the training of the model. For the training procedure, 20 epochs were done uniformly for all datasets, a batch size of 128, Adam optimizer [22], squashing constant of 0.5 and decay factor of 0.9.
The section has been split into three based on the target calibration. In section IV-B, the parameters of SENet is tweaked and the resulting top-1% and top-10% error rates are obtained. This is followed by section IV-A, where the capsule parameters are calibrated using various dimensions and quantity.

A. Capsule parameters
The number of capsules affects the overall accuracy and performance of the proposed ME-CapsNet. In table I, different capsule dimensions are selected and the influence of capsule dimension on the overall accuracy of the network was tested. We have got the best accuracy when testing ME-CapsNet with dimension of capsule set to be 8. This testing has been done using CIFAR10 dataset. In table II, we tested our architecture with three variations in the total number of capsules and the respective accuracy has been logged corresponding to it.Best results where obtained when ME-CapsNet was tested with 5 capsules. This testing has been done using CIFAR10 dataset and the dimension of capsule set to be 8.

B. SE Network parameters
As discussed in previous sections, SENets are split into Squeeze and Excitation operation. The squeeze operation consists of a pooling technique which includes max pooling, average pooling and the proposed S3P. All the pooling techniques are extensively studied in section III-A. Similarly, excitation operation is predominantly carried by the activation function like Sigmoid, ReLU, LeakyReLU and TanH. Sigmoid is an activation function that adds non-linearity and ranges between 0 to 1. Similarly, TanH is an activation

V. RESULTS
In this section, ME-CapsNet equipped with the best parameters obtained from the experimentation done in Section IV is compared alongside different backbone state-of-the-art models (Section V-B) and novel research works pertaining to CapsNet (Section V-C). Also details on the used datasets used for testing the propsed architecture is explained in V-A.

A. Datasets
Some commonly used datasets used to experiment the performance of ME-CapsNet include MNIST [23], Fashion-MNIST [24], CIFAR10 [25] and KMNIST [26]. The performance of ME-CapsNet when tested alongside these datasets can be visualized in 4 MNIST and FashionMNIST both has 10 classes with 70,000 images of size 28×28×1.CIFAR10 has 10 classes with 60,000 images of size 32 × 32 × 3. KMNIST or Kuzushiji-MNIST dataset has 10 classes is a drop-in replacement of MNIST and FashionMNIST, consisting of 70,000 images of size 28 × 28 × 1 just like those datasets. For MNIST, KMNIST and FashionMNIST datasets 50,000 images where used for training and 10,000 images for testing. For CIFAR10 dataset, 60,000 images where used for training and 10,000 for testing.

B. Comparing various backbones
In this subsection, various backbone architectures including residual network with various levels of layers, inception network and VGG network is fused as input layer for ME-CapsNet and the respective test accuracy is logged and compared systematically for four different datasets.

C. Comparing architectures
In this subsection, some state-of-the-art research works aligning to CapsNet is studied in terms of accuracy, number of parameters and the ability to reconstruct. Table V clearly shows our network, ME-CapsNet outperforms the other research works significantly with comparatively decent number of parameters using CIFAR10 dataset.

VI. CONCLUSION AND FUTURE WORK
In this research, we have proposed a novel deep learning architecture that simultaneously enhances the spatial and channel-wise relationship of features with minimum computation. This multi-enhancement based network has been coined ME-CapsNet which uses a stochastic pooling approach to strategically improve the performance of the SENets used in CapsNet. The originally proposed CapsNet was used as the base network and SENets have been fused strategically before and in between capsule layers. The squeeze operation proposed in the original SENets where altered in this work using S3P, a stochastic sampling-based pooling approach which in turn significantly improved the performance of the SENets used in the proposed ME-CapsNet. The architecture was evaluated with state-of-the-art datasets and comparatively better results in terms of accuracy and computational cost were obtained upon testing with the proposed model.
Future study will focus on evaluating ME-CapsNet on broad, complex datasets. Though the aim of the originally proposed CapsNet was to prevent the use of pooling operations to ward off the loss of information, ME-CapsNet like many other networks uses the advantages of pooling operators to enhance the performance of CapsNets especially for complex datasets. One right research direction to proceed from here would be to look for alternatives of pooling operators for increasing the performance especially for complex datasets. Also, adding attention to routing mechanism can be added to our network to improve its performance. Computational time can be further reduced by replacing the fully connected layers with capsule layers.