# NextDet: Efficient Sparse-to-Dense Object Detection with Attentive Feature Aggregation
## 3 NextDet
### Backbone
#### 3.1.1 CondenseNeXt CNN  
NextDet is designed with CondenseNeXt [4] CNN as the backbone. It is an efficient, yet robust image classification network designed to reduce the amount of computational resources required for real-time inference on resource constrained computing systems. It utilizes depthwise separable convolution wherein, a depthwise convolution layer applies 3 \(\times\) 3 depthwise convolution \(\hat{K}\) to a single input channel instead of all input channels mathematically represented by Equation (1), and then a 1 \(\times\) 1 pointwise convolution \(\widetilde{K}\) performs a linear combination of all the output obtained from depthwise convolution mathematically represented by Equation (2) as follows:  
\[\hat{Y}_{k,l,m}=\sum_{i,j}\hat{K}_{i,j,m}\cdot X_{k+1-1,l+j-1,m} \tag{1}\]  
\[Y_{k,l,n}=\sum_{m}\widetilde{K}_{m,n}\cdot\hat{Y}_{k-1,l-1,m} \tag{2}\]  
Here, \(X\) represents input feature map of size \(D_{x}\times D_{x}\times I\) and \(Y\) represents output feature map of size \(D_{x}\times D_{x}\times O\) where \(I\) corresponds to the number of input channels and \(O\) corresponds to the number of output channels. Figure 5 provides a graphical representation of the depthwise separable convolution.  
Figure 3: A general visual representation of convolution and pooling layers used to change feature map sizes between multiple (\(n\)) dense blocks of CondenseNeXt architecture which allows it to efficiently extract information of features from an input image.  
Figure 4: A visual representation of the overall mechanism of the proposed NextDet object detection network. The _backbone_ of this proposed network consists of CondenseNeXt image classifier, the _neck_ consists of Feature Pyramid Network (FPN) with Spatial Pyramid Pooling (SPP) and Path Aggregation Network (PAN) methodologies, and the _head_ consists of an attention block and YOLO pipeline.  
The design of CondenseNeXt also incorporates group-wise pruning to prune and to exorcise inconsequential filters before the first stage of the depthwise separable convolution during the training process which is arbitrated by L1-Normalization and balanced focal loss function techniques to smoothen the harsh effects of the pruning process. Equation (3) defines the count of inconsequential filters exorcised during this pruning stage, where \(G\) denotes group convolution, \(C\) denotes cardinality and \(p\) is a hyper-parameter defined for the training process to indicate a desired number of filters to be pruned, as follows:  
\[G\cdot C_{x}=I\cdot C-p\cdot I \tag{3}\]  
A new dimension is added into the design of this CNN, called Cardinality, to help improve and recover accuracy lost during the filter pruning process. To help improve the classification accuracy performance even further, ReLU6 (Rectified Linear Units capped at 6) [35] activation function has been implemented into the design by allowing the network to learning sparse features earlier than it would using ReLU activation function. ReLU6 also addresses ReLU's exploding gradient problem [36]. ReLU6 can be mathematically defined as follows:  
\[f(x)=min(max(0,x),6) \tag{4}\]  
CondenseNeXt utilizes multiple dense blocks at its core where ReLU6 activation function, Batch Normalization (BN) and convolution blocks sequentially constitute a single dense block, as seen in Figure 4. Such a dense block with \(n\) number of convolutions can be defined by the following operation where \(y_{i}\) denotes feature maps obtained from a \(A_{i}(\cdot)\) non-linear function, as follows:  
\[y_{n}=A_{n}([x_{0}\,\ x_{1}\,\ x_{2}\,\ x_{3}\,\ \cdots\,\ x_{n-1}]) \tag{5}\]