## 2 Proposed Methods
### _IA-Mask R-CNN_  
The distribution of labeled data plays an important role in the design of the network. Optimizing the network design according to the statistics and analysis of labeled data can accelerate the convergence and improve the target detection ability of the network. Therefore, we have made statistics on the width and height of the labeled data in the collected dataset, as shown in Figure 6,b. Moreover, the statistical results are further analyzed on several common anchor scales, as shown in Table 1.  
The anchor scales combination adopted by Mask R-CNN is (32, 64, 128, 256, 512). Combined with Figure 6 and Table 1, it can be found that the combination method of Mask R-CNN can cover 94.80% of the samples in height, but only 56.41% in width. The mismatch between the anchor design and the size of the labeled data directly leads to the poor performance of Mask R-CNN in engine surface defect detection. In order to solve this problem, this paper improves the anchor design, the anchor scales are set as (8, 16, 32, 64, 128, 256). This combination can cover 100% in height and 99.87% in width. In addition, the statistical analysis of the anchor ratios is shown in Figure 6. The anchor ratios adopted by Mask R-CNN is (0.5, 1, 2), which can cover 95.91% of the samples. Therefore, these ratios are also adopted in our method. In order to verify the effectiveness of designing anchor scales based on labeled data distribution, we consider different anchor scales and compare the convergence performance, as shown in Figure 7.  
\begin{table}
\begin{tabular}{c c c c c c c c c} \hline \hline  & **0–2** & **2–4** & **4–8** & **8–16** & **16–32** & **32–64** & **64–128** & **128–256** & **256–512** \\ \hline Anchor width & 0 & 0.13 & 21.03 & 22.43 & 8.48 & 5.43 & 42.50 & 0 & 0 \\ Anchor height & 0 & 0 & 0 & 5.20 & 33.41 & 20.16 & 35.85 & 5.38 & 0 \\ \hline \hline \end{tabular}
\end{table}
Table 1: Statistics of labeled data in different anchor scale ranges (%).  
Figure 5: Automobile engine part defect detection results of the Mask R-CNN. (**a**) missing defect (yellow circle); (**b**) missing defect (yellow circle); and (**c**) missing defect (yellow circle).  
Figure 6: Size statistics of samples in collected dataset, the X-axis is the size of samples, the Y-axis is the number of samples: (**a**) anchor height statistics; (**b**) anchor width statistics; and (**c**) anchor ratio statistics.  
By comparing the convergence performances of the five networks with different anchor scales, 20 epochs of training were conducted, and the results are presented in Table 2, where A represents the baseline, B represents one half of the baseline, C represents a quarter of the baseline, D stands for one-eighth of the baseline, and E stands for one-sixteenth of the baseline. By comparing the results of a total of six statistics, including the total loss and the loss of each part, it has been found that under the anchor scales of (8, 16, 32, 64, 128), the network has a lower convergence value regarding the five aspects, but the convergence of the baseline is poor from all aspects. This result verifies the influence of the anchor scales on the network convergence and shows that labeled data analysis is useful for network design. Therefore, the anchor scales of (8, 16, 32, 64, 128) are added to the Mask R-CNN framework. The Mask R-CNN with the improved anchor design is named IA-Mask R-CNN.  
Figure 7: Network convergence curves at different anchor scales: (**a**) anchor scales = (32, 64, 128, 256, 512) (baseline); (**b**) anchor scales = (16, 32, 64, 128, 256) (one half of the baseline); (**c**) anchor scales = (8, 16, 32, 64, 128) (a quarter of the baseline); (**d**) anchor scales = (4, 8, 16, 32, 64) (one-eighth of the baseline); and (**e**) anchor scales = (2, 4, 8, 16, 32) (one-sixteenth of the baseline).