# Steel Roll Eye Pose Detection Based on Binocular Vision and Mask R-CNN
## 3 Image Acquisition and Processing
### Image Segmentation
#### 3.2.1 Mask R-CNN Algorithm  
The architecture of Mask R-CNN comprises several key components: feature extraction, the candidate region network (RPN), the region of interest (ROI) alignment module, and three output branches. Feature extraction employs ResNet integrated with Feature Pyramid Network (FPN) to generate a multi-scale feature map. The RPN generates candidate frames through \(1\times 1\) convolution and selects high-quality frames for the ROI alignment module. This module aligns the feature maps and candidate frames to the same dimensions, which are then fed into a fully connected layer to produce classification and bounding box regression results. Additionally, the mask branch enhances resolution via deconvolution to obtain a pixel-level mask of the target, thereby facilitating both detection and segmentation tasks.  
1. Production and Labeling of Datasets  
A total of 100 images were initially captured, each with a resolution of 800 \(\times\) 800 pixels. Some samples from the dataset are illustrated in Figure 9.  
To enhance the model's generalization ability and reduce data similarity, we employed various data augmentation techniques. These included geometric transformations such as image translation, flipping, and affine transformations, as well as pixel-level transformations like adjusting brightness, contrast, and adding Gaussian noise. After augmenting the dataset, we further filtered out images with excessive similarity, ultimately retaining  
Figure 8: Steel coil image samples (**a**) Field sample (**b**) Experimental sample.  
Figure 9: Sample data set.  
1560 images, which suffices for neural network training requirements. This dataset was then randomly divided into training and test sets at an 8:2 ratio.  
Using the Image Labeler in MATLAB 2019a, we established two categories: \"Circle\" and \"Background\". This tool was employed to perform pixel-level labeling of the image data, resulting in segmented labeled maps of the mounting holes. The labeling outcomes are depicted in Figure 10.  
2 Network Training  
Prior to training the deep-learning network, it is essential to configure the network parameters. The specific parameter settings are as follows: the initial learning rate is set to 0.001, with a segmented learning rate decay strategy, reducing the rate every 1 epoch by a factor of 0.95. The momentum contribution from the previous step is set to 0.9, the maximum number of epochs is 10, and the mini-batch size is 1. The training is conducted in a GPU-enabled environment. During the training of the Mask R-CNN network, the loss change curves are optimized by calculating the discrepancies between predicted and labeled values, followed by backpropagation to refine the model. The loss change curve is illustrated in Figure 11.  
The horizontal axis of the graph denotes the number of training iterations, while the vertical axis represents the total loss value. As depicted, the loss value stabilized  
Figure 11: Loss variation curve.  
Figure 10: Image data labeling map.  
upon reaching 577 iterations, highlighting the model's robustness. The Mask R-CNN model's losses encompass boundary regression loss, classification loss, mask loss, RPN foreground/background classification loss, and RPN boundary regression loss. With increasing iterations, each loss component exhibited a similar trend. Notably, at 577 iterations, the total loss reduced to 0.8 and the mask loss to 0.2, signifying enhanced model fitting to the data.
3. Experimental results  
The images in the test set were evaluated using the trained target detection network, with the results displayed in Figure 12. The mounting area of the steel coil was effectively segmented from the background, demonstrating accurate recognition. The mask fit for the test set was high, indicating excellent performance.