# Compact Spatial Pyramid Pooling Deep Convolutional Neural Network Based Hand Gestures Decoder
## 4 The Proposed Methodology
### Integration of Multi-Spatial Pyramid Pooling into the Pruned DCNN  
The model and the pruning strategy described in the section above had a fundamental limitation when it comes to the image input dimension. This results in a forcible data resizing and, thus, accuracy reduction, as stated in Figure 3. [PERSON] et al. [4] proposed SPP in DCNN improves the accuracy and get rid of the input dimensions restriction. Now, some research [38; 39] have suggested combining various spatial pooling combinations including the original research from [PERSON] et al. [4]. Now, adopting the DCNN to fit in any arbitrary image input dimensions, we proposed a 3 multi-scale based pooling that has three \((1\times 1)\), \((2\times 2)\) and \((4\times 4)\) multi-scale SPP. Table 2 shows the modified pruned DCNN in the Figure 7 with the proposed Multi-scale SPP fitted after the convolutions.  
\begin{table}
\begin{tabular}{c c c} \hline
**Layers** & **Output Shape** & **Parameters** \\ \hline Input & X, X, 3 & 0 \\ (Conv2D) 32 & X, X, 32 & 896 \\ Batch Normalization & X, X, 32 & 128 \\ Max Pooling \((2\times 2)\) & X, X, 32 & 0 \\ (Conv2D) 64 & X, X, 64 & 18,496 \\ Batch Normalization & X, X, 64 & 256 \\ (Conv2D) 64 & X, X, 64 & 36,928 \\ Batch Normalization & X, X, 64 & 256 \\ Max Pooling \((2\times 2)\) & X, X, 64 & 0 \\ (Conv2D) 12 & X, X, 128 & 73,856 \\ Batch Normalization & X, X, 128 & 512 \\ (Conv2D) 128 & X, X, 128 & 147,584 \\ Batch Normalization & X, X, 128 & 512 \\ Max Pooling \((2\times 2)\) & X, X, 128 & 0 \\ (Conv2D) 256 & X, X, 256 & 295,168 \\ Batch Normalization & X, X, 256 & 1024 \\ (Conv2D) 256 & X, X, 256 & 590,080 \\ Batch Normalization & X, X, 256 & 1024 \\ Max Pooling \((2\times 2)\) & X, X, 256 & 0 \\ (Conv2D) 256 & X, X, 256 & 590,080 \\ Batch Normalization & X, X, 256 & 1024 \\ (Conv2D) 256 & X, X, 256 & 590,080 \\ Batch Normalization & X, X, 256 & 1024 \\ (Conv2D) 256 & X, X, 256 & 590,080 \\ Batch Normalization & X, X, 256 & 1024 \\ Max Pooling \((2\times 2)\) & X, X, 256 & 0 \\ Spatial Pyramid Pooling & 5376 & 0 \\ (Fully Connected) 384 & 384 & 2,064,384 \\ Batch Normalization & 384 & 1536 \\ (Fully Connected) 384 & 384 & 147,840 \\ Batch Normalization & 384 & 1536 \\ (Fully Connected) 29 & 29 & 11,165 \\ Output Softmax & 29 & 0 \\ \hline Total Parameters & & 4,575,389 \\ \hline \end{tabular}
\end{table}
Table 2: Proposed spatial pyramid pooling in the deep convolutional network. Input (X, X) denotes any arbitrary input image dimensions.  
Figure 7: Deep convolutional network after pruning; The color-coded boxes represent the layers in the model. Convolutional layers are blue (), batch normalization layers are lime () and max-pooling layers are forest green (); these are followed by a flatten layer, shown in emerald green (), a fully connected layer in violet () and the Softmax output in magenta (). The number of dimensions in each layer is shown beside/below that layer.  
As the last convolutional layer has 256 filters the SPP has 265 convolutional feature input. Subsequently, the data are filtered through 3 separate \((1\times 1)\), \((2\times 2)\), and \((4\times 4)\) multi-scaled SPP merged together. This makes the total parameters of SPP layer \((256\times 1\times 2\times 4)~{}=~{}5376\) parameters. Now, the number of multi-layer SPP \((1,2,4)\) has been decided by both trial and error and suggestion from other researches [38; 39]. Although increasing the number of pooling might further increase the accuracy, but it will add more computation overhead to the DCNN model. This proposed pruned DCNN has already been optimized with less than half of the original weight parameter with SPP based pooling. Introducing multi-scale SPP gets rid of this dimension restriction and improves the accuracy.