# Efficient Shot Detector: Lightweight Network Based on Deep Learning Using Feature Pyramid
## 3 Proposed Method
### Prior Anchor Box Design  
CNN-based detectors perform bounding box regression using prior boxes. One-stage based detectors such as YOLO and SSD do not perform region proposals but perform coordinate prediction with an output feature map. The detection performance is significantly affected because the correct coordinates are generated using a prior box for each feature map grid to be detected. After designing a network with optimal parameters, a prior anchor box was designed to improve the detection accuracy. Five heads were used for detection, and prior box parameters were set for each scale shown in Table 2.  
Based on the values presented in Table 2, a basic prior box to be used for training was defined for each head, as shown in Equation (6).  
\[P_{baseline}=\{x_{center},x_{center},w,h\} \tag{6}\]  
The prior box, which has an area based on the center point of the feature map grid, can be expressed as Equation (7).  
\[\begin{split} x_{center}&=\frac{(i+0.5)}{\text{ image}/\text{shrinkage}}\\ y_{center}&=\frac{(i+0.5)}{\text{image}/\text{ shrinkage}}\\ w,y&=\text{Box}_{\text{min}}\ /\ \text{image}\end{split} \tag{7}\]  
where \(i\) and \(j\) are the indices from the top left of the feature map plane. Shrinkage means the scaling factor of the current feature map from the input resolution. The shrinkage is divided by the image size to obtain the center point of the feature map grid. The width and height of the box from the center point are the obtained values by dividing the image by \(Box_{min}\) assigned to each head. A box is added as in Equation (8) after defining the baseline prior box to detect horizontally or vertically long objects.  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Index** & **Feature Size** & \(\text{Box}_{\text{min}}\) & \(\text{Box}_{\text{max}}\) & **Shrinkage** \\ \hline
1 & 64 & 15 & 31 & 8 \\
2 & 32 & 40 & 82 & 16 \\
3 & 16 & 92 & 184 & 32 \\
4 & 8 & 194 & 228 & 64 \\
5 & 4 & 310 & 386 & 128 \\ \hline \hline \end{tabular}
\end{table}
Table 2: Prior boxes setting value. It was set based on the input resolution of \(512\times 512\). The \(Box_{min}\) and \(Box_{max}\) values should be gradually expanded when increasing the input resolution.  
Figure 3: Feature refining process.  
\[\begin{split}\text{ratio}=\sqrt{x},\ x\in\{1,2,3\}\\ w,h=\sqrt{\text{Box}_{\text{min}}*\text{Box}_{\text{max}}}\\ w,h=\begin{cases}w*\text{ratio}\\ h\ /\ \text{ratio}\end{cases}\cdot\begin{cases}w\ /\ \text{ratio}\\ h\ *\ \text{ratio}\end{cases}\end{split} \tag{8}\]  
Three prior boxes, which detect horizontally or vertically long objects and perform bounding box regression, were generated for each feature scale through aspect ratio adjustment. Figure 4 shows an example of detection using three prior boxes.  
The prior box scale of ESDet-baseline was designed based on the input resolution of \(512\times 512\). The number of negative samples increases when the number of prior boxes is set excessively, resulting in an inefficient training. Therefore, it is important to perform detection with a minimum of prior boxes. Finally, the anchor ratio in Table 2 can also be proportionally increased when extending the input resolution of ESDet.