# Stain Defect Classification by Gabor Filter and Dual-Stream Convolutional Neural Network
## 1 Introduction  
Detecting a stain defect image is challenging because the ambiguous boundary of a stain defect with an image processing-based method is complex. A stain defect is caused by an error in the manufacturing process, such as external contaminants, uneven paint coating, and other errors. It is slightly bright or has a dark brightness in contrast to a local area, and this contrast is difficult to detect with the naked eye. Previous stain defect detection studies have detected stain defects using image processing techniques [1; 2; 3; 4; 5; 6; 7]. Kong et al. [1] proposed a method for calculating the variance of the inspection area image and judging it as a stain defect when it exceeds a certain threshold. Zhang et al. [3] detected the stain defect by calculating the Just Noticeable Difference (JND) value after applying the watershed method in the forward and reverse directions of the image to detect the boundary of the stain defect area. Han and Shi [6] extracted the wavelet image of an input image using wavelet transform and detected a stain defect by removing the background component with the difference image between the wavelet image and the input image. The above methods are methods for modeling and removing the background component and have a disadvantage in that accurate modeling of the background component is required. A study using the Gabor filter to detect stain defects has been proposed to solve this shortcoming [8; 9; 10; 11]. The Gabor filter was presented as a human visual system model and as a filter that extracts texture features using a sine wave with a specific frequency and direction. The Gabor filter detected and modeled the texture feature of the background component having the same continuous pattern and was used to detect the stain defect by removing the background component of the input image. Bi et al. [8] extracted theGabor filter image using the Gabor filter's actual part and created a binarized image based on a specific threshold to detect the stain defect on the liquid crystal display (LCD). Mao et al. [10] selected Gabor filter parameters with high stain defect classification performance by applying them to the training image. The stain defect was then detected using the selected Gabor filter. Recently, with the development of deep learning, several studies to detect defects using a CNN have been proposed [12; 13; 14; 15; 16; 17; 18; 19; 20; 21; 22; 23; 24]. Xiao et al. [12] proposed a hierarchical feature-based CNN (H-CNN) structure that generates Regions Of Interest (ROI) using region-based CNN (R-CNN) and detects the defect using a fully CNN (F-CNN). Singh et al. [14] compared the classification performance for stain defects on metal surfaces using a CNN such as ResNet [25] and YOLO [26]. Yang et al. [15] created a defect detection model by learning stain defects using the transfer learning technique of a deep CNN extractor trained in advance on the ImageNet Large Scale Visual Recognition Challenge 2012 (ILSVRC2012) dataset. Hou et al. [24] proposed a directional kernel to detect weak scratches. The segmentation method can accurately explore the shape of the defect, but it takes a long time to compute. In addition, several studies to detect defects using segmentation have been proposed [27; 28; 29]. Tabernik [27] proposed After applying segmentation, the defect was detected using the method using the detection. In addition, Huang [28] introduced The MT set first, and defects were detected using the McuePushU network. The previous deep learning-based stain defect classification method used a single inspection image as input [14; 15]. The Gabor filter image has an advantage in image texture analysis, so performance improvement is expected when used as an input for CNN. However, it is necessary to design a CNN to extract features advantageous for stain defect classification using different domains, such as inspection and Gabor filter images.