# Improved U2 Net-Based Surface Defect Detection Method for Blister Tablets
## 4 Proposed Methods
### Combination of U2 Net and LKA  
The RSU module is the core component of U2 Net for feature extraction and multi-scale fusion, which plays a very important role in accurate segmentation and efficient processing. LKA has both a broad acceptance area and a local focus. In order to change the information loss caused by the RSU module in the feature extraction stage after downsampling, which leads to the reduction of segmentation accuracy and affects the defect detection effect, in this paper, we investigate the use of LKA as the sampling component of the RSU module. There are two types of RSU modules; the first one is called RSU-L where L denotes the number of convolutional layers, and the second one is called RSU-4F. The difference between RSU and RSU-4F is that when the image is continuously sampled by the RSU-L layer, the feature size of the input image is already very small; in order to prevent the feature information from being lost, instead of using downsampling and upsampling in the next processing, the size of the features is kept constant by directly using the inflated convolution, and this is called the RSU-4F module.  
In this paper, based on the original RSU module, the LKA mechanism is introduced. Since LKA is composed of depth-wise convolution, depth-wise dilation convolution, and channel convolution, it makes the model obtain more sufficient feature information and has enough focus on small-size defective regions. As shown in Figure 4, the RSU module and LKA form a new module, which is referred to as the RSLU module in this paper. For the RSU-4F module, since the resolution size of the image features is already very small after  
Figure 3: Working process of LKA mechanism.  
Figure 2: LKA convolution module composition. (**a**) Depth-wise convolution; (**b**) Depth-wise dilation convolution; (**c**) \(1\times 1\) convolution; (**d**) LKA convolution.  
the upsampling of the RSLU-L layer, it has little spatial information and does not improve the accuracy of the model much. Therefore, the original RSU-4F module is still used in this study.  
In Figure 4, the input image is first converted into a tensor by a normal convolution layer in preparation for the subsequent use of RSLU. The input image is first passed through the RSLU-7 layer, in which the features of size H \(\times\) W extracted by the ordinary convolutional layer are accepted, and the output of size H/2 \(\times\) W/2 is obtained after 1/2 downsampling. The output is used as the input to the LKA, which decomposes it into a depth-wise convolution of size H/2d \(\times\) W/2d, a 2d \(\times\) 2d depth-wise dilation convolution, and a 1 \(\times\) 1 channel convolution, and then splices it with the features obtained from the upsampling to obtain feature fusion through the convolutional layer. When the processing of the first feature fusion of RSLU-7 is completed, the remaining sampling is performed sequentially, and the feature size of the image after five samples is H/32 \(\times\) W/32. Finally, the downsampling and upsampling of the RSLU-7 layer are completed to obtain the feature fusion map, and the remaining RSLU layers are completed sequentially.  
In Figure 4, H and W represent the height and width of the input image, respectively; Con2d performs convolution to extract features; Bn and Relu are used for batch normalization and activation function; K3 refers to the convolution kernel size of 3 \(\times\) 3; S1 refers to the step size of 1; 2 indicates the expansion factor of 2.  
Figure 4: RSLU module.