## 3 Image Increase Algorithm Based on Direction Reversal  
A neural network with strong generalization capability is obtained by expanding the training sample data to improve the quality and diversity of samples and to reduce the overfitting phenomenon of the neural network; hence, the neural network suits the application scenario and shows improved detection accuracy [23; 27; 28; 29]. [PERSON] et al. [23] used brightness changes to increase the samples. [PERSON] et al. [28] conducted white balance processing on an image of insect samples to improve the accuracy of insect detection. [PERSON] et al. [29] used adaptive histogram equalization to enhance a mango image and reduce the effect of illumination on image quality. Adaptive histogram equalization is adopted to adjust image brightness and increase the diversity of sample image illumination. Image clarity is weakened due to the fast operation of precision parts on a conveyor belt. As a result, the surfacecolor of precision machinery parts considerably differs from that of these parts under normal light, and affects the quality of sample images of precision machinery parts. The quality of training samples affects the detection effect of the model. In the present work, the horizontal reversal of the training samples and the rotation from [0\({}^{\circ}\), 22.5\({}^{\circ}\), 45\({}^{\circ}\), 67.5\({}^{\circ}\), 90\({}^{\circ}\)] were used to improve the sample image quality and increase the number of samples. A centered screenshot of the increased image was captured. The label was discarded when the object near the edge of the image was missing or completely lost. Finally, we obtained the image increase algorithm on the basis of direction reversal (IIA-DR). **Input:** Manually selected different poses, real image Ti of different backgrounds  
**Output:** Increased datasets L, and the set P of the corresponding detection object position label  
1) Set the number of increase images \(D_{i}\), and input the real image \(Ti\) of different locations and backgrounds  
selected manually;  
2) Read the real image \(Ti\), and take the input image as the template image;  
3) Manually label the image in Step 2. Obtain the position label of the precision parts and the four vertex coordinates of the rectangular box, that is, \(\left(x_{top},y_{left}\right)\right.\), \(\left(x_{top},y_{right}\right)\), \(\left(x_{bottom},y_{left}\right)\), and \(\left(x_{bottom},y_{right}\right)\);  
4) Flip template image \(Ti\) horizontally. Image datasets \(L=\left\{l_{1},\,l_{2},\,l_{3},\,\ldots,\,ln\right\}\) are generated by rotation transformation from \([0^{\circ},22.5^{\circ},45^{\circ},67.5^{\circ},90^{\circ}]\) angles;  
5) Transform the position label on the template image and obtain the corresponding four vertices, that is, \(\left(x_{1},y_{1}\right)\), \(\left(x_{2},y_{2}\right)\), \(\left(x_{3},y_{3}\right)\), and \(\left(x_{4},y_{4}\right)\);  
6) Use Formulas (8-11) to correct the coordinates of the four points. Obtain the new label of the generated single image as \(\left(x_{top^{\prime}},y_{left^{\prime}}\right)\), \(\left(x_{top^{\prime}},y_{right^{\prime}}\right)\), \(\left(x_{bottom^{\prime}},y_{left^{\prime}}\right)\), and \(\left(x_{bottom^{\prime}},y_{right^{\prime}}\right)\);  
\[x_{top^{\prime}} = \min(x_{1},x_{2},x_{3},x_{4}) \tag{8}\] \[x_{bottom^{\prime}} = \max(x_{1},x_{2},x_{3},x_{4})\] (9) \[y_{left^{\prime}}= \min(y_{1},y_{2},y_{3},y_{4})\] (10) \[y_{right^{\prime}}= \max(y_{1},y_{2},y_{3},y_{4}) \tag{11}\]  
7) If \(m=\) true, execute Steps 4-6;  
8) Output increased dataset \(L=\left\{l_{1},\,l_{2},\,l_{3},\,\ldots,\,ln\right\}\) and the corresponding set of detection object location tags  
\(P=\left\{P_{1},\,P_{2},\,P_{3},\,\ldots,\,P_{ln}\right\}\). Figure 5: Initial candidate frame selection of precision parts. On the basis of the preceding method, the corresponding image datasets and labels (including classification and position labels) were generated by the template images of different precision parts.