# Deep Lifelong Learning Optimization Algorithm in Dense Region Fusion
## 3 Materials and Methods
### Experimental Material
#### 3.3.2 Evaluation Metrics  
In the field of object detection, the most commonly used evaluation metrics include Intersection over Union, accuracy, precision, recall, \(AP\) value, \(AR\) value, and \(mAP\) value. This section provides a detailed introduction to these evaluation metrics.  
Intersection over Union (\(IoU\)) can be used to determine the degree of overlap between two images. In the field of object detection, the degree of overlap between two boxes can be determined. The calculation of \(IoU\) is shown in Equation (5).  
\[IoU=\frac{area(B_{p}\cap B_{gt})}{area(B_{p}\cup B_{gt})}, \tag{5}\]  
where \(B_{gt}\) represents the border of the actual object in the image, \(B_{p}\) represents the bounding box predicted by the detection algorithm, and \(IoU\) is calculated based on these two values, which can measure the accuracy of the bounding box predicted by the detection model. In object detection, prediction boxes with \(IoU>0.5\) are generally classified as positive samples, while the rest are classified as negative samples.  
Moreover, the correct prediction of positive samples as the number of positive samples is called true (\(TP\)), the correct prediction of negative samples as the number of negative samples is called true negative (\(TN\)), the incorrect prediction of negative samples as the number of positive samples is called false positive (\(FP\)), and the incorrect prediction of positive samples as the number of negative samples is called false negative (\(FN\)). The accuracy, precision, and recall are calculated as follows:  
\[Acc=\frac{TP+TN}{TP+FN+FP+TN}. \tag{6}\]  
\[Pre=\frac{TP}{TP+FP}. \tag{7}\]  
\[Recall=\frac{TP}{TP+FN}. \tag{8}\]  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Dataset** & **Total** & **Training Set** & **Validation Set** \\ \hline Bird’s nest foreign body & 385 & 300 & 85 \\ Damaged cement pole & 384 & 300 & 84 \\ Shockproof hammer slipping & 385 & 300 & 85 \\ Insulator self-explosion & 376 & 300 & 76 \\ \hline \hline \end{tabular}
\end{table}
Table 2: The detailed information of four defect datasets.  
Figure 5: Example of bird’s nest foreign object dataset image. The defects are marked inside the red box.  
By combining accuracy and recall, a PR curve can be drawn, with recall as the horizontal axis and accuracy as the vertical axis. The larger the area between the PR curve and the axes, the better the performance of the detection model.  
The average precision (\(AP\)) represents the area enclosed by the PR curve and the coordinate axis, which can be calculated using Equation (9).  
\[AP=\int_{0}^{1}P(r)dr. \tag{9}\]  
\(AP\) is a relatively important evaluation metric, which is generally calculated based on different \(IoU\) thresholds for \(AP\) under various thresholds. For example, \(AP_{50}\) and \(AP_{75}\) represent the measured values of \(AP\) at \(IoU\) thresholds of 0.5 and 0.75, respectively. Furthermore, it is possible to calculate all \(AP\) values separately with an \(IoU\) step of 0.05 from \(AP_{50}\) to \(AP_{95}\), and then take the average value and record it as \(AP_{50.95}\). This value can fully evaluate the detection effect from more perspectives.  
The average recall (\(AR\)) is the average of all recalls for \(IoU\) from 0.5 to 1.0, and its calculation formula is shown in Equation (10):  
\[AR=2\int_{0.5}^{1}recall(o)do. \tag{10}\]  
The mean average precision (\(mAP\)) of categories is the average value of \(AP\)s under each category. In the field of object detection, it may be necessary to simultaneously detect multiple categories of objects, and \(mAP\) can effectively evaluate the effectiveness of a model in predicting multiple categories of targets. The calculation of \(mAP\) is shown in Equation (11).  
\[mAP=\frac{\sum_{i=1}^{K}AP_{i}}{K}, \tag{11}\]  
where \(K\) is the number of categories detected, and \(AP_{i}\) represents the \(AP\) value under the \(i\)th category. If there is only one detection category, then \(mAP\) is equal to \(AP\).