## 5 Experiments
### Parameter Setup
#### 5.1.1 Loss Function Setting  
In the process of Faster-R-CNN training, a loss of multitasking results; i.e., the classification information and the bounding box position information need to be corrected. The total mission loss of the Faster R-CNN network consists of the loss of the RPN, the fine-tuning loss of the classification network, and the L2 regularization loss. The Faster R-CNN loss function formula is shown in Equation (2). \(L\) represents the total loss value of Faster R-CNN, \(L_{p}\) represents the loss value of the RPN, \(L_{C}\) represents the fine-tuning loss value of the classification network trimming, and \(L_{R}\) represents the regularization loss value of the weight value, which is L2:  
\[L=L_{P}+L_{C}+L_{R} \tag{2}\]  
(1) RPN region proposal network loss function  
The final output of the RPN involves two parts: one part is the binary classification output--i.e., it is the object or it is not the object--and the other part is the bounding box regression output including the center coordinates and size of the candidate bounding box. The total loss of the defined RPN is the sum of two loss functions, as shown in Equation (3):  
\[L_{P}=\frac{1}{N_{cls}}\sum_{i}L_{cls}(p_{i},p_{i}^{*})+\lambda\frac{1}{N_{ reg}}\sum_{i}p_{i}^{*}L_{reg}(t_{i},t_{i}^{*}) \tag{3}\]  
where \(i\) is the \(i\)-th anchor, \(p_{i}\) is the probability that the \(i\)-th anchor predicts that it is the object, \(p_{i}\)* represents the \(i\)-th anchor's real category. If \(p_{i}\)* = 1 represents the detection object, \(p_{i}\)* = 0 means it is not a detection object. \(T_{i}\) is a 4-dimensional vector representing the position and size of the \(i\)-th anchor, and \(t_{i}\)* represents the real position and size of the \(i\)-th anchor. For the classification, the loss function \(L_{cls}\) uses Softmax Loss, with two categories. For the bounding box regression, the loss function is Smooth L1 Loss, and \(p_{i}\)*\(L_{reg}\) means that the loss function of the bounding box regression is calculated only when \(p_{i}\)* = 1; that is, when the anchor detects the object, then it calculates the loss of the bounding box regression. The loss of classification and bounding box regression needs to be normalized with \(N_{cls}\) and \(N_{reg}\) and parameters to speed up the convergence of iterative calculations and prevent divergence. \(N_{cls}\) and \(N_{reg}\)  
where \(x\), \(y\), \(w\), and \(h\) represent the center coordinates and dimensions of the RPN output bounding box, \(x_{a}\), \(y_{a}\), \(w_{a}\), and \(h_{a}\) represent the center coordinates and dimensions of the anchor, and \(x^{*}\), \(y^{*}\), \(w^{*}\), and \(h^{*}\) represent the center coordinates and dimensions of the real bounding box. (2) Classification network fine-tuning loss function  
The classification network fine-tunes the loss function in the same form as the RPN. The difference from the RPN loss function is the two-part content of the output of the classification network: the first part is the object category--here, according to this item, there are 5 categories--and the second part is the center coordinate and size of the bounding box regression output bounding box, but the number of candidate bounding boxes is different from the RPN, because a large number of untargeted and overlapping blocks are removed in the RPN screening anchor and non-maximum suppression. (3) L2 regularization loss function  
The main function of the regularized loss function is to add an index describing the complexity of the model to the loss function. By limiting the weight value, the model cannot arbitrarily fit the random noise in the training data, which can effectively prevent over-fitting after the model training. The commonly-used regularization comprises two kinds of function: L1 and L2.