Incorporating Visual Defect Identification and Determination of Occurrence Side in Touch Panel Quality Inspection

This study explores a visual inspection system incorporating defect detection and the judgment of the defect occurrence side in touch panel fabrication. The surface of a touch panel is transparent glass with conductive lines inside to achieve the purpose of touch control. When touch panels are manufactured, it is the front sides of the products that are primarily processed and are treated with stricter standards. Therefore, it is important to correctly distinguish the defect locations occurring on the front or back side to ensure the quality of the touch panels. We first apply the Hilbert-Huang transform to enhance the contrast between the defects and the background. Second, statistical interval estimation is used to segment background and defects to achieve defect detection. Third, the detected defects on both sides of the substrates are combined and numbered for feature extraction. Fourth, the random forest model is applied to judge where the defects occur on the front or back of the transparent substrates. Experimental results show that the defect detection rate achieves 85.75%, and the false alarm rate is lower to 0.33%. The correct location judgment rate of the defect occurrence is 98.62% on the front and back sides of the touch panels.


I. INTRODUCTION
Touch panels commonly used in many electronic devices today are composed of a multilayer film and two or more transparent substrate glass. The surface of a touch panel is transparent glass with conductive lines inside to achieve the purpose of touch control. There are regular conductive electrodes and conductive lines in the panel as the background. According to the design and functional considerations of different manufacturers, there are many textured background patterns of touch panels with various conductive electrodes and conductive lines. Capacitive Touch Panel (CTP) has the advantages of waterproof, dustproof, oil resistance, fast response, etc., which is the mainstream trend of touch panels on the market. The CTP has a transparent glass surface and The associate editor coordinating the review of this manuscript and approving it for publication was Yizhang Jiang . a regular texture of an inner transparent conductive film, as shown in Figure 1.
The types of defects that often occur in the touch panel manufacturing process are scratches, cracks, dirt, watermarks, etc. These defects are mainly caused by factors such as improper cleaning by personnel, negligence during handling, etc. Surface defects of touch panels can be roughly classified into line defects and area defects according to their shapes. The line defects are scratches and cracks, which are directional; while the area defects are dust and watermarks, which are low contrast, uneven brightness, and irregular shape. Table 1 lists the characteristics of common visual defects occurring on touch panels. The existence of defects not only affects the appearance and quality of the product but may also seriously lead to the loss of product functionality. The location of the defect occurrence on the front or the back is very important quality process information, and the correct occurrence location can help to find the cause of process abnormalities.
Conductive patterns can interfere with the inspection of panels for visible defects, which are more difficult to detect than non-patterned glass products. In addition, the touch panel has good visual penetration, which makes it difficult to distinguish whether the defect occurs on the front side or the back side. The front side of the panel is precisely machined during the manufacturing process, so the tolerance for defects on the front side of the panel is low. However, the front and back sides of a transparent workpiece are very similar, and it is difficult to know whether the defect is on the front side or the back side when inspecting. This makes it difficult to confirm the actual location of the defect.
Usually, when identifying front and back defects, it is necessary to focus and take two images on the front and back of the panel and identify the location of the defect by analyzing the two focused images. Figure 2 shows two testing samples including (a) line defects and (b) area defects, respectively. The images of these samples are captured with (1) focusing on the front side and (2) focusing on the back side, respectively. The red circles and red ovals in the figures represent the defects that occur on the front sides, and the blue rectangles represent the defects that occur on the back sides. As can be seen from Figure 2, the same defects appear in the images focused on the front and back sides, and the visual difference in the appearance of the defects is not large.
Panel surface defects have the following difficulties to be overcome during detection: First, due to astigmatism and light transmittance of transparent materials, it is difficult to capture clear images, and afterimages and noise are prone to occur in the captured images; Second, owing to the variety of background textures of the touch panels, the detection will be interfered by the textures and lead to false judgments; Third, for transparent glass with a thin thickness, the difference between the front and back images is small, and it is difficult to detect defects and determine the location of defects; Fourth, The same defect will appear in both the front and back images, making it difficult to determine the actual location of the defect.
The purpose of this research is to develop an automatic defect detection and defect location judgment system for touch panels with textured backgrounds under the framework of machine vision. Therefore, this study discusses the inspection items of high-precision processing of transparent glass that relies heavily on personnel experience and judgment due to its material properties and proposes detection technology and system development for defect detection and front and back side judgment of defect occurrence locations. Through the developed visual inspection system, the production of touch panels achieves the goal of improving the overall quality.

II. LITERATURE REVIEWS
Transparent materials have good visual penetration properties and are widely used in many production processes, such as transparent substrates, diffusers, polarizing films, optical fibers, glass, etc. When these transparent workpieces are photographed by imaging equipment, due to the astigmatic properties of the workpiece material and the different illumination methods of the light source, afterimages and noises often appear in the images, which may easily lead to misjudgments in image processing. Jin et al. [1] used the projection grating method to create fringe patterns on transparent glass for defect detection. Nishu et al. [2] detected various glass defects such as scratches, inclusions, surface flaws, etc., and evaluated them through color space conversion selection and a segmentation algorithm. At present, many works of literature discuss the detection and classification of surface defects on transparent workpieces [3]. This type of transparent material has a uniform or random texture in the background, and the defects are more obvious. Few studies discuss the defect detection of transparent workpieces with structural texture backgrounds. The testing samples with textured backgrounds are more complicated in visual inspection.
Conductive glass is transparent glass with structural lines. It has the function of conducting electricity through the conductive film. It has been widely used in optical devices. Jian et al. [4] proposed a positioning based on image contours for mobile phone screen glass and can identify defects on the screen. The problem of defect detection is complicated by the difference in defect type and the textured background of the touch panel image [5]. When a panel image with a fourdirectional and cyclical background texture is transformed into a Fourier domain, four main strips with high-energy frequency interlace at the middle of the Fourier spectrum. Lin et al. [6] used the spectral characteristics of Fourier transform and matched them with multi-crisscross filtering to delete the parts with higher energy values. After Fourier inversion back to the spatial domain, the background texture can be attenuated. Lin et al. [7] proposed a method based on wavelet transformation to check the defects of the area on the appearance of the touch panel. For touch panel detection, the structural texture of the background is various, and the proposed method may not be suitable for various texture characteristics. Hung and Hsieh [8] used the characteristics of the periodic pattern of the sensing texture to adaptively learn each background pattern, and then compare it with the standard board to extract the flaws to achieve the effect of flaw detection. In reviewing the above literature, they all  detect and classify the surface defects of touch panels [6], [7], [9], [10], [11], but few studies discussed the issue of the transparent panel defects occurring on the front side or the back side of the panel.
When the front and back of the product are similar in appearance or are made of transparent materials, there will be a problem that the front and back sides are difficult to distinguish, resulting in many difficulties in identification, measurement, and detection. Carlson and Le [12] proposed that the wafers should be inspected on both the front and back sides. When there is a defect on the back side, the front side at the same position will be compared and correlated. Gevigney [13] proposed a method using laser Doppler velocimetry. Based on the frequency characteristics, the front and back sides of the transparent wafers were distinguished and inspected. Minami et al. [14] proposed that the source of transparent substrate defects is the attachment of contaminants to the patterned front side and fewer defects occur on the back side. In addition, different levels of processing and quality requirements will be applied to the front and back of the product during the manufacturing process, so it is necessary to judge the front and back of the product to ensure product quality.
The glass substrate of the touch panel is transparent and contains a variety of structural lines. The defects generated in the process are even more diverse. Many scholars have discussed this aspect, mainly to remove certain lines or only the detection of some specific flaws [6], [7]. For the detection of some specific textures, the position of the sample must be fixed to keep the same orientation of the texture in the image, and then remove the background. This method has limited efficiency and benefit for workpieces with various texture backgrounds. At present, few methods can deal with multiple types of textures and defects at the same time. The Hilbert-Huang transform (HHT) proposed in this study is different from the above research methods. It uses the Bidimensional Empirical Mode Decomposition (BEMD) image decomposition and the Hilbert transform (HT) to attenuate the background and increase the contrast between the defects and the background. Therefore, the HHT method can reduce the influence of different texture angles caused by different workpiece placement positions, and different background textures have less influence on this method, which can detect more types of defects.
The Hilbert-Huang transform proposed by Dr. E Huang is a method for analyzing nonlinear and non-stationary data. The VOLUME 10, 2022 method consists of empirical mode decomposition (EMD) and Hilbert transform (HT) [15]. The HHT is specifically designed to handle data from non-stationary and nonlinear processes without any assumptions or assumed basis functions. The main features of the HHT are its adaptive signal decomposition and filtering in the temporal /spatial domains [16]. Xia et al. [17] used the HHT to decompose and filter these surface measurement data before extracting engineering surface features. Guo et al. [18] applied the timefrequency energy matrix of the distribution network fault signal to the sampled fault signal through the HHT method. Laradij et al. [19] proposed the HHT and support vector machine for seizure classification of electroencephalogram signals. Trusiak et al. [20] applied the HHT to peak detection of medical signals for heart disease.
The EMD is converted from one-dimensional to bidimensional empirical mode decomposition, which is often used in image processing, face recognition, and texture analysis. Lu et al. [21] proposed to improve the long execution time of the BEMD procedure and applied it to the agricultural fruit defect detection system. Qin et al. [22] applied BEMD to ground-penetrating radar images to suppress the noise from the BEMD decompositions. Nunes et al. [23] used BEMD to extract features at spatial frequencies to detect regional maxima and radial basis functions for surface interpolation. The HHT has a good effect in many different fields such as image processing, health monitoring, and agricultural product inspection [19], [21], [24].
The decision tree is an attractive classifier due to its fast execution speed. However, for problems with high complexity, the accuracy of analyzing data is not high. Ho [25] proposed a way to build multiple trees randomly and complement each other for improvement. A random forest is thus a combination of tree predictors, each depending on a random and independent distribution of all trees in the forest using the same method [26]. Shipway et al. [27] aimed at fluorescent penetrant inspection to detect surface defects in the aerospace industry. The random forest is used to classify the defects. Even with very small training samples, it showed good discrimination ability. Alickovic et al. [28] established an automatic Alzheimer's disease detection system and used the random forest as the classification. Kamalalochana et al. [29] developed a visual inspection system to inspect apple leaves and use random forests as classifiers to detect diseases in apple leaves.
Jr Piedad et al. [30] used machine learning to rank bananas for grading and compare multilayer perceptron, support vector machine, and random forest. The results show that random forest has good classification results and accuracy in both training and testing. Dhingra et al. [31] utilized nine famous classifiers for measuring leaf texture discrimination power and found that random forest outperformed other classifiers on leaf texture graph analysis. The random forest method has many different application fields, such as food grading, and insect and plant classification, and has a good effect [32], [33], [34].
Since the touch panel is a high-precision, thin-thickness optoelectronic product, the defects are tiny flaws that may repeatedly appear on the front and back sides of panels, which may easily cause misjudgment of identification. In the production process of the product, the processing requirements and defect handling standards of the front and back are different. Distinguishing the location of defects on the front and back can reduce misjudgment and improve the efficiency and benefit of process improvement. Therefore, we propose a vision system based on machine learning technology to perform defect detection and judgment of occurrence location, that is, the defect occurs on the front or back of the touch panel. With proper parameter settings, the system can not only detect various types of defects but also determine where the defects occur.

III. PROPOSED APPROACH COMBINING HILBERT-HUANG TRANSFORM AND RANDOM FOREST METHOD
This study is aimed at identifying the defects on surfaces of the touch panel with regular background lines and judging the defect occurrence side of the touch panel. The proposed approach is divided into five steps: first, to compare the imaging difference of the same defect in two images, two testing images are taken when the workpiece is individually captured with a focus on the front side and a focus on the back side. Second, by applying the HHT method to attenuate the background texture and then enhance the defect contrast, we use the BEMD scheme to achieve the effect of attenuating the background texture and the HT to achieve the effect of defect enhancement. Third, a threshold is calculated and applied to the enhanced image to separate defects from the background using a statistical interval estimation method, and the detected defects are then merged into one image. Fourth, we perform the defect numbering according to the defect position on the merged image, then extract the feature vector of each numbered defect for further classification. Fifth, the random forest method is applied to judge the defect occurrence side of the touch panel by classifying the numbered defects into front defects, back defects, and non-defects. Figure 3 shows the workflow of the stages of the proposed approach.

A. IMAGE ACQUISITION
In this study, testing samples with a 1.67 mm thickness, a 132mm width, and a 220 mm length, are provided by a touch panel manufacturing company. All samples are randomly selected from the manufacturing process of touch panels. To distinguish whether the defect is located on the front or the back side, it is necessary to take two images with a focus on the front side and a focus on the back side, respectively. By capturing a local area of a panel, the imaging differences between a front focus and a back focus are displayed in the gray level variations and sharpness of the defect. The local detailed information will help judge whether the defect occurs on the front or the back side. Because the touch panel has texture, it needs to be illuminated with a blue coaxial light  source. The touch panel is placed on the inspection platform and the high-magnification lens is used for taking images of a local area so that the texture and defects can be clearly presented in the captured images. Figure 4 illustrates the setup of image capturing devices and the apparatus arrangement of image acquisition for capturing a testing touch panel.
To acquire the digital imaging of a testing panel with proper intensity, the lighting control of the environment is also important when acquiring images.

B. IMAGE CONTRAST ENHANCEMENT AND DEFECT DETECTION
Because the background conductive lines of a touch panel will interfere with the inspection of surface defects, it is necessary to reduce the effect of background texture and highlight the contrast of the defects to facilitate subsequent defect detection. In the defect enhancement stage, this study applies the HHT method to the captured front and back images, respectively. The HHT method is applied to attenuate the background texture and then enhance the defect contrast. We use the BEMD scheme to decompose a testing image into a frequency image and a residual image and then perform the HT conversion on the two decomposed images, respectively, to achieve the effect of attenuating the background texture. After that, we extract the real part of the normalized HHT image, which can further increase the contrast between the defect and the background to achieve the effect of defect enhancement.
For image processing and analysis, BEMD is required to extract two-dimensional Intrinsic Mode Function (IMF) frequency images. After the touch panel image in this study is decomposed by BEMD, it is decomposed from high frequency to low frequency according to the frequency of the image, and a testing image f (x, y) is decomposed into two images, which are an IMF frequency image IMF 1 (x, y) and a residual image r n (x, y) , respectively, as follows, where IMF k (x, y) is the k frequency images generated after the BEMD decompositions. Among the frequency images decomposed by BEMD, the first frequency image contains most of the local features in the original data, and the residual image contains fewer local features. The method uses the calculation of local maxima and minima to decompose the image through the average envelope of the cubic curve, into a frequency image and a residual image. The first frequency image represents the high frequency in the image. The clearer the background texture of the touch panel and the texture characteristics of defects, the more detailed the edge of the image will be, and these details will be preserved in this frequency image. The residual image is a low-frequency image, and the outline of the image begins to appear blurred. Only the outline of the image can be seen, but the details cannot be seen. Figure 5 shows the decomposition results of the front and back defect images.
The BEMD generates the envelope through multiple iterative screening processes. Each image needs to be decomposed through a large number of operations. The more images are decomposed, the more process iterations are used. The stopping criterion set in standard deviation (SD) will affect the process iteration of an image. The more process iterations, the longer the execution time, maybe resulting in a waste of execution time. Therefore, the number of decomposed images (k) and the stopping criterion (T ) are the more important parameters in the BEMD.
The Hilbert transform is performed on the decomposed image, which is convolved 1/π through the impulse response, it conducts the extraction of the real instantaneous signal of the image. In this study, HT conversion is performed on the IMF 1 frequency image and the residual image r n respectively, we will obtain the complex frequency image of IMF 1 and r n . The complex frequency images HX k (u, v) and HX r n (u, v) of the IMF 1 and r n are expressed as, After the process of HT conversion, the defects are highlighted in the IMF 1 frequency image, and the background of the frequency image becomes much smoother. The two images are accumulated to become an accumulated image after conducting HHT. The background texture in this cumulative HHT image is attenuated, but the contrast between the defects and the background is low. Since the grayscale value of the accumulated image is between [0, 1], this study uses the normalization method to convert the grayscale VOLUME 10, 2022 so that the difference between the light and dark contrast of the image is widened. By increasing the contrast of the grayscale values through normalization, the normalized image nor (u, v) can be presented more clearly. An example of the above process is shown in Figure 6 for the results of conducting the HT conversions on the front and back defect images.
After the process of BEMD decomposition and HT conversion, the process of HHT conversion is completed. In this study, the IMF frequency defect images are selected after HHT conversion for enhancement, and the background is diluted. This method of enhancing defects does not require fixed workpiece orientation and capture position, nor does it need to know the characteristics of the background texture in advance to remove the background. This method is beneficial to remove backgrounds with complex regular textures, and is suitable for various texture backgrounds, avoiding the disadvantage that the defects overlapping with the background will be removed together when the background is removed. When the HHT method performs BEMD decomposition, it needs to iteratively perform interpolation calculation and envelope process on the image, and it takes a long time to complete the decomposition process.
After the test image undergoes HHT conversion, the image pixels become complex data types, as shown in Equation (4). There are real and imaginary numbers in the values. The real part has more information containing analytical signals with more texture features, while the imaginary part has less information, so the imaginary numbers can be discarded without losing the major information. The comparisons of the real parts and the imaginary parts of the front and back normalized HHT images are shown in Figure 7. The extracted imaginary image is rendered black, and the information in the image cannot be preserved. We further normalize the accumulated HHT image and extract the real number part with information to increase the contrast between the defect and the background, that is, extract the real number part of the image in Equation (4) as Equation (5).
When a testing image undergoes HHT conversion to achieve the effect of background texture attenuation and defect enhancement, the textured background and defects have a high contrast at this time. The statistical interval estimation method is used to select the appropriate threshold in image segmentation for separating defects and background. If the value is set less than the threshold, the defect is displayed in black, and if the value is greater than the threshold, the background is displayed in white. After dividing by the interval boundary, the effect of separating the defect and the 90218 VOLUME 10, 2022 background is shown in Figures 7(a3) and 7(b3), i.e. the defect detection results of the front and back defect images by the HHT method.

C. FRONT AND BACK SIDE JUDGMENT OF DEFECT OCCURRENCE POSITION
In this stage, the merged images obtained from defect detection are used to judge the front and back of the defect occurrence position. In this study, the defect detection results of the front and back defect images are combined with the OR logic operation to complete the image merging, and the corresponding defect features are extracted from the front and back images by locating the positions of the defects in the merged images. Since multiple defects can occur per image, individual defects are counted at this stage. We number each defect and then extract the feature values of the defect in the original and binarized front and back images (the difference in grayscale means, the difference in grayscale standard deviations, defect area, and defect perimeter), and use the random forest method for classification. The detected defects are individually divided into three categories: front side defects, back side defects, and non-defects. In this study, the intensity features and geometric features of the front and back images are extracted for each defect respectively, and the corresponding feature values of the front and back of the defect are subtracted to obtain the difference between the defects in the two images on the front and back. The brightness of a defect is the intensity that describes the flaw. The defect's geometric properties reflect the flaw's size and shape. The front defects are marked with red circles and the back defects are marked with blue squares in Figure 8. Taking the front side defect as an example, if the front side is focused as shown in Figure 8(a1), the grayscale value of the defect will be lower and the shape of the defect will be clearer. If the front side defect is in focus on the back side, as shown in Figure 8(b1), the defect will appear blurry and the grayscale value of the defect will be higher. Defect shapes with wrong focus after binarization are likely to have broken edges, resulting in defects that are not closed-form. The area and perimeter of such defects will be larger. Through these difference analyses, the difference in grayscale means, the difference in grayscale standard deviations, and the area and perimeter of the geometric features, the defects are classified and the positions of the defects are judged on the front side or the back side.
In this study, the random forest method is used to judge the defect occurrence side, and each decision tree in the random forest is a different classifier and is used to judge the position of the defect. Different features can be selected to increase the diversity of the classifier, and it is implemented in parallel processing, so the execution process is quite fast [24], [35]. Decision trees are generated independently to maintain high accuracy and noise immunity when data is imbalanced or missing [4], [15]. Through the classification results of decision trees, the opinions from each tree can be collected to be voted. The category with the highest vote is the occurrence side of the defect. Figure 9 is an example of the defect occurrence side judgment by the random forest method. During the defect detection stage, some background textures and flaws will be detected as potential defects at the same time. These background textures are misjudged flaws and such misjudged flaws will be classified as a non-defect type. Therefore, this study classifies each detected defect into three categories: front side defect, back side defect, and nondefect. Figure 10 shows the processed results of three stages including image merging, defect numbering, and occurrence side judgment in the classification of the detected defects.

IV. IMPLEMENTATION AND ANALYSES OF EXPERIMENTS
In this study, the Matlab R2013b version is used to implement the proposed algorithms for defect detection and position judgment of defect occurrence on the front and back sides of touch panels. The types of equipment used are a personal computer (Intel Core i5 processor, 4GB * 1 RAM, operating system Win7), a 5-megapixel CCD (Charge Coupled Device) camera model KP-FMD500WCL of Hitachi company, a lens with 1 to 10 amplifications of changeable focal lengths, a frame grabber model IMAQ PCI-1411 of National Instruments Corporation, an inspection platform, and a blue linear LED lighting device. The captured images are resized to VOLUME 10, 2022 FIGURE 9. An example of the tree structure of the defect occurrence side determined by the random forest method. 256 × 256 pixels in a 1:1 ratio. Each image of the surface has a gray level of 8 bits.
In this study, one image is taken as the basic unit of calculation and the detection results are compared with the manually detected images. In terms of defect detection, we define the false alarm rate of the normal areas, the defect detection rate of the defect areas, and the accuracy classification rate as performance evaluation indicators. The false alarm rate of normal areas (α), misjudging normal areas as defect areas, divides the districts of regular regions inspected as defects by the districts of actual normal regions. The defect detection rate of the defect area (1-β), succeeding to alert true defects, divides the districts of detected true defects by the districts of overall true defects. The accuracy classification rate (ACR) is the ratio of the correctly detected regions to the total region of a testing image.
In terms of location judgment of defect occurrence, the accuracy classification rate (1-γ ) is revised as the performance evaluation index with the number of defects as the basic unit. The detected defects are judged individually into three types, front side defect, back side defect, and nondefect, by the random forest method and they are checked whether each type is classified correctly. The ACR (1-γ ) is the ratio of the number of defects classified in the correct type to the total number of defects.

A. PARAMETER SETTINGS OF THE HHT METHOD
When a testing image is decomposed by the BEMD scheme, the decomposition process calculates the average envelope through the cubic curve and subtracts the average envelope from the image to obtain a new IMF image. There are many iterations in the process so it takes a lot of time to execute. There are two parameters in BEMD that can be adjusted to improve the execution efficiency, namely the number (k) of IMF frequency images and the threshold value (T ) of the stopping criterion SD value. The BEMD decomposes a testing image from high frequency to low frequency and obtains multiple IMF frequency images and a residual (r n ) image as shown in Figure 11. With the change in the number of decomposed images, each frequency image represents different meanings. When k = 2 indicates the information of the testing image divided into two images, the amount of information obtained by the two images is the same and the execution time is 5.07 seconds. When the number of decomposed images is larger, it means that there are more iterations and more time is spent. When k = 5, the testing image is decomposed into four frequency images and one residual image, and the execution time is 23.47 seconds. The IMF 1 image represents a high-frequency image, which has more image information and obvious texture features. The other IMF frequency images contain less and less information in sequence, and the residual image is a low-frequency image with the remaining information after decomposition. Figure 11 also shows the results of the performance evaluation of the frequency images decomposed into different numbers. The detection effect of each image is the same but there is a significant difference in the execution time. When the image is decomposed into more images, the number of iterations will increase and the time will be longer. Therefore, in this study, k = 2 is chosen as the BEMD image decomposition parameter.
The BEMD process ordinarily sets the criterion for stopping the sifting process by calculating the standard deviation (SD). When the stopping criterion SD value is less than the threshold value (T ), the first component of the BEMD procedure is generated, which is the first IMF frequency image. A new image is obtained by subtracting the first frequency image from the testing image, and then the new image is used for decomposition to generate other IMF frequency images in sequence. The set of threshold T values will affect the important parameters of the time length in the iterative process. An appropriate parameter needs to be selected to shorten the execution time. In this study, the T value was set at different threshold values. After setting the T value to 1, the execution time decreased significantly, from 5.11 seconds to 2.6 seconds, but there is no difference in the detection results. A drop in execution time can be seen in Figure 12. This means that if the stopping criterion SD value exceeds the value 1, the length of time in the iterative process will be shortened significantly, and then this time will remain stable. Therefore, this study chooses T = 1 as the threshold value of the stop standard SD value.

B. PARAMETER SETTINGS OF THE RANDOM FOREST MODEL
The random forest method can adjust the structure of the classifier through parameter settings to improve the classification effect. This study will adjust the number of trees and the depth of trees to evaluate the performance of classification. If the number of trees is set too large, the calculation and VOLUME 10, 2022 classification time will increase, and if the depth of trees is excessively increased, the diversity of the tree will be reduced and the classification effect will also be reduced. Therefore, it is necessary to try several combinations of different parameters, and set appropriate parameters according to the characteristics of the problem itself.
The size of the random forest architecture depends on the number of trees to determine how many decision trees are needed in the forest. The number of trees is the number of times the classifier is executed, that is, how many decision trees are used for classification. The number of trees chosen in the random forest method must be large enough to make the error small. The larger the number of forests used and the larger the forest scale, the test error will gradually converge with the increase of the scale, but at the same time, the amount of calculation will also increase, which is prone to overfitting. Usually, 500 decision trees are enough to solve general problems [36]. In this study, the number of trees is used as the parameter for testing, and forests consisting of 150, 200, 250, 300, 350, 400, 450, and 500 decision trees will be tested.
The depth of trees in the random forest method is composed of the different number of features selected for each decision tree to increase the diversity of the forest. The greater the number of selected features in a decision tree, the greater the depth of the decision tree and the greater the effect of a single decision tree, but each decision tree in the forest is similar, resulting in a decrease in diversity and prediction accuracy. Conversely, it can not only speed up the processing time but also reduce the prediction error. The depth of trees is used as the parameter for testing, and each decision tree can randomly select D features from the 4 features. Table 2 summarizes the parameter settings of the random forest model applied in this study.
According to the combinations of the number of trees (H ) and the depth of trees (D), the two parameters are matched with different setting levels and a total of 32 classifier combinations are tested. The accuracy classification rate (1-γ ) and the execution time of testing are used as indices to evaluate the classification results. The 50 training samples and 30 testing samples are used to adjust the parameters to construct a random forest structure with a better parameter combination and conduct subsequent experiments with large samples. The performance evaluation results of parameter settings of the random forest model are shown in Table 3. It is found that the more features and decision trees are used, the better the experimental results might not be obtained. When three combinations of (H = 300, D = 1), (H = 500, D = 2), and (H = 500, D = 3) are used to establish the random forests, the diversity of the classifiers can be improved, and the accuracy classification rate of 95.69% can be achieved. However, using 500 decision trees and more selected features requires a lot of training and testing time, (H = 500, D = 2) for 0.326 seconds and (H = 500, D = 3) for 0.328 seconds, so this study chooses (H = 300, D = 1) for 0.240 seconds as a suitable parameter setting  for the random forest method. This selected combination reaches the highest accuracy classification rate and a reasonable computational complexity (computation time) of the random forest model. Figure 13 shows the plot of testing time vs accuracy classification rate of the random forest method using different combinations of parameter settings to judge the defect occurrence locations. In the real-time implementation of these algorithms, the relationship between computational complexity and accuracy classification should also be considered. Subsequent large-sample experiments will be conducted by using the parameter settings.

C. COMPARISONS OF DEFECT DETECTION RESULTS AND OCCURRENCE SIDE JUDGMENT RESULTS BY THE EXISTING METHODS AND THE PROPOSED APPROACH
In this study, 462 images are used for large sample experiments in the defect detection part. In the front and back position judgment part of defect occurrence, 208 images are used for training, 150 normal images and 104 defect images are used for testing, and experiments are carried out with the selected parameter settings. The results of the proposed approach are evaluated and compared to the performance of other existing methods, the Otsu method for threshold selection in the time domain [37], the energy filtering method in the Fourier spectrum [6], the flat zone filtering method in the wavelet domain [7], and the band energy filtering method in curvelet domain [38]. Table 4 indicates the differentiating effects of defect detection outcomes in the  performed trials. One time domain method and four frequency domain techniques are evaluated contrary to the results by practical examiners. The average defect detection rates (1-β) of total trial samples by the four methods are, 78.07% by the Otsu method, 86.37% by the Fourier method, 87.68% by the wavelet method, 82.44% by the curvelet method, and 85.75% by the suggested HHT method. However, the three existing techniques have notably larger false alarm rates (α), 32.73% by the Otsu method, 5.62% by the Fourier method, and 5.53% by the wavelet method. Contrarily, the curvelet method and the suggested HHT scheme have quite smaller false alarm rates of 0.51% and 0.33%, respectively. The suggested method has a larger accuracy classification rate (ACR) 99.58% than the other skills applied to defect detection of touch panel images. More concretely, the suggested approach has a larger defect detection rate as well as a smaller false alarm rate utilized for panel images having structural textured background.
The average processing time for treating an image with 256 × 256 pixels is as follows: 0.04 seconds by the Otsu method, 0.65 seconds by the Fourier method, 0.16 seconds by the wavelet method, 0.68 seconds by the curvelet method, and 2.06 seconds by the suggested HHT method. The HHT method needs to perform the BEMD procedure on the image, and the decomposition process needs to go through many iterations, resulting in a longer execution time of the method.
The mean processing time of the suggested scheme is nearly three times larger than that of the curvelet method yet it can be improved for the actual fulfillment of an automatic optical detection system through parallel processing and hardware enhancement. Although the proposed method has a longer processing time, it well balances the trade-off between the defect detection rate (85.75%) and false alarm rate (0.33%), and reaches a correct classification rate of 99.58%, outperforming the traditional defect detection techniques in defect inspection of touch panel products.
To explore the effects of the proposed approach, it is compared with the competing method using performance evaluation indices. The defect detection is compared with the curvelet transformation (CT) and the defect location judgment is compared with the back-propagation neural (BPN) network. In this study, the random forest method is used to judge the front and back positions of defects, and the same data is used to compare the performance evaluation index with the BPN network. The accuracy classification rates of the BPN model and the random forest model are 83.62% and 98.62%, respectively, under the same defect detection of the HHT method as shown in Table 5. Therefore, when using the same feature values with different classifiers, the accuracy classification rate of the random forest method proposed in this study is better than that of the BPN network model. The classification effect of the random forest method is more VOLUME 10, 2022  sensitive than the BPN network. The partial detection results of defect images by the two methods are shown in Figure 14. The CT filtering method has a lower detection rate and a higher false alarm rate than the HHT method in defect detection. This will lead to more misjudgments of defect locations in subsequent processes.
The curvelet conversion has the advantage of fast execution efficiency. However, in defect detection, a fixture is needed to fix the placement of the workpiece, and the CT filtering method of removing the fixed-angle background is only suitable for workpieces with a specific background texture. When processing the defect detection of workpieces with various background textures, it is necessary to frequently change the parameter settings for the detection. This study proposes to apply the HHT method to defect detection of touch panels. The defect detection effect is not much different from that of the CT filtering method, but the orientation of the workpiece can be arbitrarily placed without the aid of a fixture in the application, so it can be more widely used in touch panels with different background texture types. Therefore, this study proposes that the HHT method not only has a good detection effect but also has a wide range of applications.  Table 6 shows the common background textures in capacitive touch panels. To expand the inspection objects of this study, experiments are carried out for the following seven textures to illustrate the feasibility of the proposed method and to discuss the influence on defect detection results of different background textures. In this study, the thickness of the workpiece is used as the basis for adjusting the focal length when shooting, and the testing workpiece is shot with the front and back sides of the focus, respectively. The difference between the images focused on the front and the back is used to detect defects and determine whether the defect occurs on the front or the back. If the thickness of the workpiece is thicker, the difference between the front-focused and back-focused images will be greater, which is beneficial for defect detection and front and back position judgment. Therefore, this study discusses the defect detection and position judgment for different workpiece thicknesses.
The performance evaluation results of defect detection of different background textures are shown in Table 7, the ROC curves of the detection effects of different textures are drawn as shown in Figure 15, and the plot of defect detection rate and correct side judgment rate for different workpiece thicknesses is shown in Figure 16. Figure 17 presents the partial results of defect detection on panel images with different background textures. Texture 2 is a similar background texture as Texture 1 used in the previous experiments, but with more obvious black spots on the texture. During the defect detection 90224 VOLUME 10, 2022  process, the darker color of the black spots causes some background textures to be misjudged as defects. Texture 2 and texture 5 are textures with high complexity, and background textures and defects are confusingly detected at the same time, resulting in a higher misjudgment rate. The repetitive patterns of textures 3, 4, 6, and 7 are relatively simple. After conducting the HHT method, the effect of background texture attenuation and defect enhancement can be achieved. This indicates that the proposed method can broadly detect various types of background textures.
Since various texture samples have different workpiece thicknesses, textures 3 and 5 belong to thin workpieces whose VOLUME 10, 2022  thickness is less than 1.3 mm. Textures 1, 2, 4, 6, and 7 are thicker workpieces whose thickness is greater than 1.5 mm. When the thickness of the workpiece is thicker, the false alarm rate of defect detection is lower as shown in Figure 15, and the effect of the correct classification rate of defects is better as shown in Figure 16. When the thickness of the workpiece is thinner, the false alarm rate is higher and it is not easy to identify the real location of defects. The workpiece with texture 2 has a thicker thickness of 1.74 mm and has black spots on the background pattern. During defect detection, the black spots are frequently detected together with the defects, resulting in more false alarms, which makes the judgment of the front and back positions of the defects ineffective. In a limited thickness range, the thickness difference of the workpiece is not large, and the influence on the judgment of the position of the front and back of the defect is small.
In this study, texture 1 is the main workpiece to be detected and the thickness of this workpiece is 1.67 mm. If the thickness of the glass substrate of the touch panel is changed and is reduced within the range of 26%, using this proposed method to detect the defects and judge the position of the front and back of the defects has a good effect. There are various types of touch panels with different background textures. The proposed method is also applied to other commonly used six different background textures for performance evaluation, and it reveals good defect detection and classification effects, and its application is more extensive.

V. CONCLUSION
This study incorporates visual defect identification and the judgment of the defect occurrence side into the touch panel quality inspection. The proposed method performs automatic inspection of defect detection and judges whether the defect location on the touch panel occurs on the front side or the back side. After capturing two images by focusing on the front and back sides of the touch panel, we perform the HHT method to achieve the effect of background texture attenuation and defect enhancement. Then, we use the method of interval estimation to binarize the enhanced image, which can correctly divide it into the normal area and defect area, so as to achieve the effect of defect detection. In judging the front or back of the defect occurrence location, we merge the binary defect images on the front and back into one, number the defects in the merged image, and then extract the grayscale and geometric feature values of the defects as the feature vector input to the classifier. Finally, the random forest method is proposed to determine whether the defect occurs on the front or back of the touch panel. Experimental results show that the method achieves a defect detection rate of 85.75% and a false alarm rate of 0.33% in normal regions. In the front or back side judgment of the defect occurrence location, the classification accuracy reached 98.62%. The proposed approach is effective and an extension of other existing techniques.
The developed system can maintain a good detection effect in the face of difficult low-contrast images and area defects with uneven brightness. This indicates that this research method can be applied to high-low contrast images and can detect line and area defects at the same time. However, there are still some issues that need to be improved. It can be further explored from the following two directions: (1) execution efficiency improvement of the HHT method; (2) unable to determine the occurrence locations of the front and back defects partially overlapped. The application and development of this research can be extended to test and verify images with the same characteristics as transparent material products, such as glass substrates, optical films, optical fibers, etc., to further promote the applications of appearance defect detection and judgment system for defect occurrence locations in transparent workpieces.
HONG-DAR LIN received the Ph.D. degree in industrial engineering from the University of Missouri, Columbia, USA, in 1994. He is currently a Professor with the Department of Industrial Engineering and Management, Chaoyang University of Technology, Taichung, Taiwan. His research interests include quality management, applications of machine vision systems, automated inspection and metrology, machine learning, pattern recognition, and algorithms of information fusion.
ZI-TING QIU received the B.Sc. and M.Sc. degrees in industrial engineering and management from the Chaoyang University of Technology, Taichung, Taiwan, in 2018 and 2020, respectively. Her research interests include quality management, applications of machine vision systems, automated inspection and metrology, and pattern recognition.
CHOU-HSIEN LIN received the B.Sc. degree in architectural engineering from the University of Texas at Austin, TX, USA, in 2020, where he is currently pursuing the M.Sc. degree in civil engineering. His research interests include indoor air quality, exposure pathways of air pollutants, and the health effects of volatile organic compounds in the built environment.