# A Real-Time Chinese Traffic Sign Detection Algorithm Based on Modified YOLOv2
## 3 The Chinese Traffic Sign Detection Algorithm Based on Modified YOLOv2
### The Network Architecture of YOLOv2  
YOLO employs a single neural network to predict bounding boxes and class probabilities directly from full images in one inference. It divides the input image into \(S\times S\) grids. Each grid cell predicts \(k\) bounding boxes and confidence scores of bounding boxes, as well as \(C\) conditional class probabilities. Furthermore, each bounding box is represented by a quintuple (\(x\), \(y\), \(w\), \(h\), _cfd_). The (\(x\), \(y\)) coordinates are the center offset of the bounding box compared to the bounds of the grid cell. The \(w\) and \(h\) are the width and height predicted relative to the whole image, respectively. The confidence _cfd_ is defined as \(\mathrm{P_{r}(Object)}*\mathrm{IOU}_{\mathrm{pred}}^{\mathrm{truth}}\). The value of \(\mathrm{P_{r}}\) (Object) is 1 when a grid cell contains a part of a ground truth box, otherwise it is 0. The IOU is the intersection over union between the predicted bounding box and the ground truth box. By these predictions, we can obtain the class-specific confidence score of each bounding box and finally select the bounding boxes having high scores in each grid cell to predict objects in the image globally. YOLOv2 improves a great deal on the basis of YOLO. One of the improvements is the introduction of the concept of the anchor from Faster R-CNN into the original framework to enhance the network performance. The anchors represent parameterized proposals. Each anchor is associated with a scale and aspect ratio with hand-picked priors acquired from the training set. YOLOv2 exploits those prior anchor boxes to predict bounding boxes and improve the precision of their center locations.  
In this paper, we construct a deep convolutional network based on the end-to-end detection algorithm to achieve real-time Chinese traffic sign detection. Figure 4 illustrates the algorithm applied to the Chinese traffic sign detection. Each grid generates \(k\) bounding boxes according to the prior anchor boxes. To increase the loss from bounding box coordinate predictions, YOLO adds the parameter \(\lambda_{\mathrm{coord}}\) when the bounding box covers the object. The best bounding box is decided by the value of IOU. YOLO also adds the parameter \(\lambda_{\mathrm{noobj}}\) to decrease the loss from confidence predictions that the given box does not contain the object.  
For the regression method, we can calculate the loss function as follows:  
\[\begin{array}{l}F(loss)=\lambda_{\mathrm{coord}}\sum\limits_{i=1}^{S^{2}} \sum\limits_{j=1}^{k}1_{ij}^{\mathrm{obj}}(x_{i}-\hat{x}_{i})^{2}+(y_{i}-\hat {y}_{i})^{2}+\lambda_{\mathrm{coord}}\sum\limits_{i=1}^{S^{2}}\sum\limits_{j =1}^{k}1_{ij}^{\mathrm{obj}}(\sqrt{w_{i}}-\sqrt{\hat{w}_{i}})^{2}+(\sqrt{h_{ i}}-\sqrt{\hat{h}_{i}})^{2}\\ +\sum\limits_{i=1}^{S^{2}}\sum\limits_{j=1}^{k}1_{ij}^{\mathrm{obj}}(C_{i}- \hat{C}_{i})^{2}+\lambda_{\mathrm{noobj}}\sum\limits_{i=1}^{S^{2}}\sum\limits_ {j=1}^{k}1_{ij}^{\mathrm{noobj}}(C_{i}-\hat{C}_{i})^{2}+\sum\limits_{i=1}^{S^ {2}}1_{i}^{\mathrm{obj}}\sum\limits_{\mathclap{c}\in\mathrm{classes}}(p_{i} (c)-\hat{p}_{i}(c))^{2}\end{array} \tag{1}\]  
\(1_{i}^{\mathrm{obj}}\) denotes that the grid cell \(i\) contains part of a Chinese traffic sign. \(1_{ij}^{\mathrm{obj}}\) represents the \(j\)th bounding box in grid cell \(i\). Conversely, \(1_{ij}^{\mathrm{noobj}}\) represents the \(j\)th bounding box in grid cell \(i\) which does not contain any part of traffic signs. The time complexity of Formula (1) is O (\((k+c)\times S^{2}\)), which is calculated for one image.  
To accomplish the algorithm on the VOC dataset and common objects in context (COCO) dataset, YOLO and YOLOv2 were used to design a convolutional neural network for each, respectively, which are shown in Table 1. In YOLOv2, the route layer is used as a passthrough layer to extract features from the other layers and combine the feature maps. The reorg layer is used to rescale the feature maps.  
Figure 4: The Chinese traffic sign detection algorithm.