## 2 Aircraft Structural Crack Detection Method
### YOLOv3  
YOLOv3 is a deep convolutional architecture designed for object detection, which uses the darknet as the feature extract network and then using dimension clusters as anchor boxes for predicting bounding boxes of the system. Four co-ordinate (\(t_{x},t_{y},t_{w},t_{h}\)) values for each bounding box and their confidence scores are output from the input image directly through the regression operation, as well as class probabilities. Confidence scores represent the precision of the predicted bounding box when the grid contains an object.  
At the training stage, the three feature maps (\(13\times 13,26\times 26,52\times 52\)) output from the feature extract network. Taking the feature map of size \(13\times 13\) as an example, the proposed method divides the feature map into \(13\times 13\) grids. Each grid takes charge of the object detection in case the ground truth is contained in it. the predictions will be obtained as:  
\[\begin{split} b_{x}&=\sigma(t_{x})+C_{x}\\ b_{y}&=\sigma(t_{y})+C_{y}\\ b_{w}&=p_{w}e^{t_{w}}\\ b_{h}&=p_{h}e^{t_{h}},\end{split} \tag{3}\]  
where the \((C_{x},C_{y})\) denote that the center of an object is detected in a grid which is offset from the top left corner of the feature map; \((p_{w},p_{h})\) denotes the width and height of the anchor box prior, respectively; and \((t_{x},t_{y},t_{w},t_{h})\) are the four offset co-ordinate predicted by the network. Using a sigmoid to compress \(t_{x}\) and \(t_{y}\) to \([0,1]\), the target center can be effectively ensured to be in the grid cell executing prediction. A bounding box, with dimension priors and location prediction, is shown in Figure 4.  
The loss function of YOLOv3 is composed of three parts: a co-ordinate prediction error (terms 1 and 2), a confidence score (terms 3 and 4) which is the intersection over union (IoU) error, and a classification error (the last term). This loss is defined as follows:  
\[\begin{split} Loss=&\lambda_{coord}\sum_{i=0}^{S^{2 }}\sum_{j=0}^{B}1_{ij}^{obj}[l(x_{i},\hat{x}_{i})+l(y_{i},\hat{y}_{i})]\\ +&\lambda_{coord}\sum_{i=0}^{S^{2}}\sum_{j=0}^{B}1 _{ij}^{obj}[(\sqrt{w_{i}}-\sqrt{\hat{w}_{i}})^{2}+(\sqrt{h_{i}}-\sqrt{\hat{ h}_{i}})^{2}]\\ &+\sum_{i=0}^{S^{2}}\sum_{j=0}^{B}1_{ij}^{obj}l(C_{i},\hat{C}_{i })\\ &+\lambda_{noobj}\sum_{i=0}^{S^{2}}\sum_{j=0}^{B}1_{ij}^{noobj}l( C_{i},\hat{C}_{i})\\ &+\sum_{i=0}^{S^{2}}1_{i}^{obj}\sum_{c\in classes}l(p_{i}(c),p_{ i}(c)),\end{split} \tag{4}\]  
where \(1_{ij}^{obj}\) indicates that the target is detected by the \(j_{th}\) bounding box of grid \(i\). In order to increase the loss from bounding box coordinate predictions and decrease the loss for confidence predictions for boxes that do not contain objects, the parameters \(\lambda_{coord}\) and \(\lambda_{noobj}\) are introduced and both set to 5. Then, \(\hat{x}_{i}\), \(\hat{y}_{i}\), \(\hat{w}_{i}\), \(\hat{h}_{i}\) are the predicted bounding box parameters of center co-ordinates and box size. \(x_{i}\), \(y_{i}\), \(w_{i}\), \(h_{i}\) are the actual parameters, \(\hat{C}_{i}\) is the prediction of the confidence score, \(C_{i}\) is the true data; \(p_{i}(c)\) indicates the true value of the probability of the object in grid \(i\) belonging to class \(C\); and \(\hat{p}_{i}(c)\) isthe predicted value. Except for the box size error, which uses the mean square error, the others use the binary cross-entropy loss \(l(a,\hat{a})\) which is defined as follows:  
\[l(a,\hat{a})=-a_{i}log\hat{a}_{i}+(1-a_{i})log(1-\hat{a}_{i}). \tag{5}\]