# Chinese Character Boxes: Single Shot Detector Network for Chinese Character Detection
## 3 Proposed Method
### Proposed CCB-SSD Network and NMS  
**Proposed Network** This paper solved the three problems mentioned above by using the proposed single-stage based network and NMS. Figure 3 presents the flow of the whole detection process from the network structure and input to obtain the detection result. Resnet-34 [34] to a \(\frac{1}{8}\) scale was used as the base network. The feature map from Resnet-34 passes through 7 3 \(\times\) 3 convolution layers, downsamples to half the size through one 3 \(\times\) 3 convolution layer with a stride by 2, and then through 8 3 \(\times\) 3 convolution layers. Therefore, the input scale is downscaled to \(\frac{1}{16}\) of the total and the offset and the confidence score for the bounding box are calculated using the 3 \(\times\) 3 convolution from the last feature map. Finally, the proposed NMS is used to obtain the final detection results. This is a fully convolutional structure except for one pooling layer of Resnet-34. The orange and blue arrows mean the same feature map. **Training Strategy** Training strategies generally follow the content of conventional SSD. Each ground truth box is matched with a default box with best jaccard overlap and default boxes with any ground truth and jaccard overlap greater than 0.5 are then matched. According to conventional SSD, this matching strategy can simplify learning and obtain high scores from the network. The loss function for training is given in Equation (1). \[L(c,x,l,g)=\frac{1}{N}(L_{conf}(x,c)+L_{loc}(x,l,g)) \tag{1}\]  
\[L_{conf}=-\sum_{i\in Pos}^{N}x_{ij}^{p}\ log(\hat{e}_{i}^{p})\ -\sum_{i\in Neg}log(\hat{e}_{i}^{0})\quad where \quad\hat{e}_{i}^{p}=Softmax \tag{2}\]  
\[ \begin{array}{c}L_{loc}=\sum_{i\in Pos}^{N}\ \sum_{m\in\{cx,cy,y,h\}}\ x_{ij}^{p}\ \ MSE(\hat{l}_{i}^{m},\hat{g}_{j}^{m})\\ \hat{g}_{j}^{cx}=\frac{(\hat{g}_{j}^{cx}-\hat{d}_{i}^{cx})}{\hat{d}_{i}^{x}} \ \ \ \hat{g}_{j}^{cy}=\frac{(\hat{g}_{j}^{cy}-\hat{d}_{j}^{cy})}{\hat{d}_{i}^{y}}\ \ \ \hat{g}_{j}^{w}=log(\frac{\hat{g}_{j}^{w}}{\hat{d}_{i}^{x}})\ \ \ \hat{g}_{j}^{h}=log(\frac{\hat{g}_{j}^{h}}{\hat{d}_{i}^{h}})\end{array}  \tag{3}\]  
Figure 2: Network architecture of the conventional SSD. \(x\) is an indicator matrix that indicates whether or not to match. A value of 1 is given if the \(i\)-th default box matches the \(j\)-th ground truth and 0 otherwise. \(p\) is a specific category; \(N\) is the number of default boxes matched; \(l\) is the predicted box; \(g\) is the ground truth box; \(c\) is the confidence for category \(p\) and \(d\) is the default box. The mean squared error (MSE) loss instead of smooth L1 loss was used to obtain the location loss in conventional SSD. Therefore, the MSE function of \(L_{loc}\) in Equation (3) is expressed as \((\hat{l}_{i}^{m}-\hat{g}_{j}^{m})^{2}\) and the softmax of Equation (2) is expressed as \(\varepsilon_{i}^{p}=\frac{exp(c_{i}^{p})}{\sum_{p}exp(c_{i}^{p})}\). Information about \(cx\), \(cy\), \(w\), and \(h\) of the default bounding box and ground truth is encoded and the detector learns information about the difference. Therefore, the coordinates predicted by the detector are offset by the difference. The network initialization method uses He et al. [35] called Kaiming He initialization. **Proposed Non-Maximum Suppression** As mentioned above, a conventional SSD uses a multi-scale feature map structure and does not take the relationship between multiple classifiers into account, thereby duplicating the same object. The CCB-SSD network proposed in this paper was a single-scale based detection network but the same problem arises. Each part or stroke of a character also serves as a character. Owing to the nature of these characters, overlapping detection is likely to occur by detecting the regions of actual characters and strokes or other words within them as shown in the right image of Figure 4a. This problem can be solved by using a recognizer, but this paper solves the aforementioned problem in NMS because it is a network study for more accurate detection which is a previous step of recognition.