# A Hard Example Mining Approach for Concealed Multi-Object Detection of Active Terahertz Image
## 4 Methodology
### The Basic Detector  
RetinaNet [11] is a one-stage object detection algorithm, which directly regresses and classifies the bounding box. Its network structure is shown in Figure 4 except for the red part. In this network, the Resnet-50 structure [22] is selected as the feature extraction network (Blue part). In order to make the model have better multi-scale detection capability, the feature pyramid structure of high-level and low-level feature fusion was adopted (Green part). The final multi-level feature map is followed by the sub-network of object classification and bounding box regression (Purple part). \begin{table}
\begin{tabular}{l l} \hline \hline
**Item** & **Detail** \\ \hline Number of images & 3157 \\ Image size and format & 335 \(\times\) 880 p.x. JPEG \\ Imaging resolution & 5 \(\times\) 5 mm \\ Models & 4 males, 6 females \\ Number of categories & 11 \\ Objects per image & 0, 1, 2, 3 \\ Maximum object size & 13,390 p.x. \\ Average object size & 3222 p.x. \\ Minimum object size & 390 p.x. \\ Testing set & 316 images \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Detail statistics of terahertz object detection dataset. Figure 3: Average size of bounding box and quantity for each class in terahertz object detection dataset. Deep residual networks use blocks of residuals to connect the inputs and outputs of adjacent layers, improving the \"gradient disappearance\" and \"gradient explosion\" problems in model training. The feature pyramid combines high-level and low-level features to improve the detection performance of the model. The input features are obtained from each feature pyramid level, and then the convolution layer decoding features with four convolution kernels of 3 \(\times\) 3 and output channels of 256 are used. The difference lies in the final output layer. The output of the classification sub-network converts the output channel to be the same as the number of object categories (K) multiplied by the number of detection anchors (A), i.e., the number of output channels is K \(\times\) A. Finally, the prediction results of each channel are binarized through the sigmoid function to determine whether it is the corresponding category of the channel. The output of the detection box regression sub-network passes through the linear transformation converts the output to a vector of 4 \(\times\) A. Classification sub-network does not share parameters with box regression sub-network. Sub-networks share parameters among different levels of the feature pyramid. Object detection problem is a typical class imbalance problem. Take the two-class object detection as an example: the number of negative samples (i.e., scene background) needed for training is often much larger than the number of positive samples (i.e., objects). However, in the model training process to minimize the loss function, the introduction of a large number of negative class samples often causes bias, resulting in the decline of detection accuracy. Focal Loss (FL) are designed for the unbalanced sample problem in RetinaNet. FL is based on the binary cross-entropy function as follows:  
\[CE(p,y)=\left\{ \begin{array}{cc}-\log(p)&y=1\\ -\log(1-p)&y=-1\end{array} \right. \tag{1}\]  
In Formula (1), \(p\) represents the probability of prediction, with a positive label \(y=1\) and negative label \(y=-1\). \(P_{t}\) is defined as follows:  
\[P_{t}=\left\{ \begin{array}{cc}p&y=1\\ 1-p&y=-1\end{array} \right. \tag{2}\]  
We can obtain \(CE(p,y)=CE(P_{t})=-log(P_{t})\). In Formula (2), \(p\) represents the probability of model prediction, with positive label \(y=1\) and negative label \(y=-1\). The larger the prediction value of the positive class is, the better the prediction value of the negative class is, which is equivalent to optimizing the \(P_{t}\) of all samples to the maximum. The binary classification cross entropy can calculate the classification error  
Figure 4: Network structure of modified RetinaNet. C1–C5 represent the resnet-50 feature extraction structure, and P2 to P7 represent the feature pyramid structure.