# Vision-Based System for Black Rubber Roller Surface Inspection
## 2 Visual Inspection System
### Defect Detection Based on the Deep Learning Method  
In addition to using the traditional method, we propose using an artificial intelligence network to identify errors on the rubber roller.  
In order to be able to accurately and quickly detect errors with a short delay, and with the requirement to quickly process photos and videos at hundreds of frames per second, we use the YOLOv7 network with advanced techniques. Such as with CNNs, skip connection and multi-scale training are used to improve error detection accuracy and speed. Figure 12 below shows an overview block diagram of the implementation of defect detection using deep learning.  
Figure 11: (**a**) As a result of applying the Canny edge detector algorithm, the defect is now clearly identified. (**b**) The defects are now clearly identified by coloring blue color.  
After collecting data (videos) from the machine vision system presented in Section 2, we proceed to separate images from video; then, the input data set has been established. Because the image quality is not good enough to meet the accuracy and performance requirements of the defect detection process, data preprocessing is applied. The preprocessed images are labeled in the next stage. Four typical defect types are selected for labeling. After that, the data training process is conducted on Google collapse. At the end of the process is the experimental result, and the rubber rollers are classified according to each type of defect.  
Before going to the network, the input image (resolution) is resized to 640 \(\times\) 640, which then is used as the input to the model. The entire network architecture after the fusion is shown in Figure 13. The backbone network is first used to extract features from the input images. In order to maintain multi-scale information, the neck network receives multi-scale feature maps from the backbone network, which provides a variety of scales and serves as the neck network's input. After the neck network, shallow fine-grained information and deep semantic information from feature maps are fused, increasing the expressive capacity of the network and assigning the multi-scale learning task to numerous detection networks of various sizes. The output of the detection prediction is created after the feature information has been combined and modified.  
Images' textures, colors, and shapes are extracted as features using a backbone network. It may offer a variety of scales, sensing field sizes, and center steps, accommodating the needs of different scales and categories. Figure 13A illustrates the backbone network's feature extraction process. First, the backbone network passes through four CBS modules for convolution, normalization, and activation. Next, the E-ELAN block and MP block are used to extract features in an alternating fashion. Finally, the result of the final three E-ELAN blocks is used as the income data for the neck. As illustrated in Figure 14a,e, the MP block is made up of MaxPool and CBS modules, and the E-ELAN block is made up of several convolutional layers.  
The neck network's job is to fuse the learned multi-scale information together and distribute the backbone network's multi-scale output learning to multiple feature maps. This improves the model's perceptual wildness, successfully separates the most important contextual features, and partially avoids the image distortion problem. As shown in Figure 13C, the model's prediction results are obtained by combining the feature data with the 1 \(\times\) 1 convolution to produce the final prediction data. This is done after the backbone and neck networks have extracted two features from the input image.  
Figure 12: Defect detection using deep learning.  
Figure 13: The whole model structure. (**A**) Backbone network structure for extracting feature; (**B**) neck network structure for fusion feature; (**C**) detect network structure for obtaining the inference output, and C is the number of predefined classes.