# Knowledge-Driven Network for Object Detection
## 3 Proposed Approach
### Backbone Parts
We define the bottom-right corner pooling layer in a similar way. For example, for the top-left corner, we scanned from right to left for the horizontal max-pooling and from bottom to top for the vertical max-pooling. For the bottom-right corner, we scanned from left to right for the horizontal max-pooling and from top to bottom for the vertical max-pooling. We then directly added two max-pooled feature maps. We thus adopted corner pooling to better aggregate the top-left corner and the bottom-right corner by encoding explicit prior knowledge. **Loss function. ** In the task of object detection, the principle of loss function should be designed to optimize object localization and recognition. Our loss function for an image is defined as Equation (1):  
\[Loss=L_{heatmap}+\alpha L_{pull}+\beta L_{push}+\gamma L_{offset}, \tag{1}\]  
where \(L_{heatmap}\) designates a variant of focal loss, which is used to train the network to detect corners. \(L_{pull}\) is a pull loss for corners, which determines whether a pair comprising the top left corner and bottom-right corner is from the same bounding box or not. \(L_{push}\) is a push loss for corners, which aims at separating the corners from different bounding boxes. \(L_{offset}\) is used to train the network to predict the offsets of corners and applies the smooth L1 loss. \(\alpha\), \(\beta\), and \(\gamma\) denote the weights for the corresponding losses, and we set them as 0.1, 0.1, and 1, respectively, as we have found that if the values of \(\alpha\) and \(\beta\) are set as 1 or larger, this leads to poor detection performance. \(L_{heatmap}\), \(L_{pull}\), \(L_{push}\), and \(L_{offset}\) are all defined in the following:  
\[L_{heatmap}=\frac{-1}{\text{N}}\sum_{c=1}^{C}\sum_{h=1}^{H}\sum_{w=1}^{W} \Biggl{\{} \begin{array}{c}(1-p_{clw})^{\lambda}\log(p_{clw})\quad if\ y_{ chw}=1\\ (1-y_{clw})^{v}(p_{clw})^{\lambda}\log(1-p_{clw})\ otherwise\end{array} , \tag{2}\]  
\[L_{pull}=\frac{1}{N}\Sigma_{k=1}^{N}\Bigl{[}(e_{tk}-e_{k})^{2}+(e_{bk}-e_{k}) ^{2}\Bigr{]}\, \tag{3}\]  
\[L_{push}=\frac{1}{N(N-1)}\Sigma_{k=1}^{N}\Sigma_{j=1,j,\
eq k}^{N}\text{max} \bigl{(}0,\Delta-\bigl{|}e_{k}-e_{j}\bigr{|}\bigr{)}, \tag{4}\]  
\[L_{offset}=\frac{1}{N}\Sigma_{k=1}^{N}SmoothL1({}_{k},\ \hat{\ast})\, \tag{5}\]  
where \(p_{clw}\) is the score at location \((h,\ w)\) for class \(c\) in the predicted heatmaps, and \(y_{clw}\) is the ground-truth heatmap augmented with the unnormalized Gaussians. \(N\) denotes the number of objects in an image, and \(\lambda\) and \(\
u\) are the hyperparameters that control the contribution of each point. In Equation (3), \(e_{tk}\) is used to denote the embedding for the top-left corner of object \(k\), \(e_{bk}\) stands for the bottom-right corner, and \(e_{k}=(e_{tk}+e_{bk})/2\). In Equation (4), the maximum distance is 1 for two corners from different objects, and we set \(\Delta\) to be 1 in all our experiments. In Equation (5), \(k\) is the ground-truth offset, \(\hat{\ast}\) denotes the predicted offset, and \({}_{k}=\bigl{(}\frac{x_{k}}{n}-\bigl{|}\frac{x_{k}}{n}\bigl{|}\,\frac{y_{k}}{n}-\bigl{|}\frac{y_{k}}{n}\bigl{|} \bigr{)}\), where \(x_{k}\) and \(y_{k}\) are the \(x\) and \(y\) coordinates for corner \(k\).