# Application of Lightweight Convolutional Neural Network for Damage Detection of Conveyor Belt
## 2 Principles and Methodology
### Calculation of Loss-Function  
The loss function during network training consists of three parts: regression loss \(L_{CloU}\), classification loss \(L_{class}\), and confidence loss \(L_{conf}\). Among them, the regression loss \(L_{CloU}\) refers to the error between the position and width of the prediction box and the true label; the classification loss \(L_{class}\) refers to the error between the prediction classification and the real classification, and the confidence loss \(L_{conf}\) is relevant to the confidence score of the predicted value of each bounding box. The calculation method of the loss function is shown in Equations (6)-(11). The regression loss of the prediction frame is calculated by \(CloU\) function, and the scale information of the overlap, center distance, and aspect ratio of the frame is considered based on \(IoU\), which can better ensure the  
Figure 4: The structure of YoloV4.  
Figure 5: The backbone feature extraction network of MobilenetV1.  
stability of the training process; the calculation of confidence loss and classification loss uses cross-entropy function.  
\[L_{CIoU}=1-IoU(A,B)+\frac{\rho^{2}(A_{ctr},B_{ctr})m^{2}}{+}av \tag{6}\]  
\[\alpha=\frac{\
u}{1-IoU+\
u} \tag{7}\]  
\[\
u=\frac{4}{\pi^{2}}(\arctan\frac{w^{st}}{h^{st}}-\arctan\frac{w}{h})^{2} \tag{8}\]  
\[\mathds{k}_{conf}=\sum_{i=0}^{S^{2}}\sum_{j=0}^{B}I^{obj}_{ij}[\bar{C}_{i}^{j }\log(C_{i}^{j})+(1-\bar{C}_{i}^{j})\log(1-C_{i}^{j})]+\lambda_{noobj}\sum_{i= 0}^{S^{2}}\sum_{j=0}^{B}I^{noobj}_{ij}[\bar{C}_{i}^{j}\log(C_{i}^{j})+(1-\bar{ C}_{i}^{j})\log(1-C_{i}^{j})] \tag{9}\]  
\[\mathds{k}_{class} =\sum_{i=0}^{S^{2}}I^{obj}_{ij}\sum_{c\textit{classes}}[\bar{P}_ {i}^{j}(c)\log(P_{i}^{j}(c))+(1-\bar{P}_{i}^{j}(c))\log(1-P_{i}^{j}(c))] \tag{10}\] \[Loss=L_{CIoU}+L_{conf}+L_{class} \tag{11}\]  
In the equation, \(IoU(A,B)\) -- the intersection ratio between the predicted box and the real labeled box; \(\rho^{2}(A_{ctr},B_{ctr})\) -- the Euclidean distance between the predicted box and the line point in the real labeled box; \(m\) -- the diagonal distance of the smallest enclosed area that contains both the predicted box and the real labeled box; \(\alpha\) -- weight function; \(\
u\) --length-to-width ratio similarity measurement coefficient; \(w^{st},h^{st}\) --width and height of the real label box; \(w,h\) -- width and height of the prediction box; \(S^{2}\) -- number of grids; \(B\) -- prediction box on each grid; \(I^{obj}_{ij}\) -- the target is included in the prediction frame; \(I^{noobj}_{ij}\) -- the target is not included in the prediction frame; \(C_{i}^{j}\) --prediction confidence; \(\bar{C}_{i}^{j}\) -- true confidence; \(\lambda_{noobj}\) -- calculation coefficient set by yourself; \(c\) -- target classification number; \(P_{i}^{j}(c)\) -- the true probability that the target in the frame belongs to a certain category; \(\bar{P}_{i}^{j}(c)\) -- the predicted probability that the target in the frame belongs to a certain category.  
When there is no target in the prediction frame, only the confidence loss \(L_{conf}\) should be calculated. If there is a target in the prediction frame, three types of losses could be calculated according to Equations (6)-(11).