Edge Intelligence in Internet of Things using Machine Learning 2022View this Special Issue
A Diffuse Reflection Approach for Detection of Surface Defect Using Machine Learning
Diffuse reflection occurs when light, further waves, or particles are reflected off a surface in such a way that a ray encountered on the surface is dispersed at several angles instead of one as in specular reflection. With the rapid development of modern industry, irregular diffuse reflection may appear due to the particles on the surface, such as frosted paint surfaces, making the defect information easy to be covered up by scattered light, preventing the defect from being detected, and reducing detection accuracy. Therefore, this paper aims to deeply explore the diffuse reflection surface defect detection approach based on machine learning. The Gray code and four-step phase shift technique are used to resolve the absolute phase of a reflection image while the image defect is determined by converting the absolute phase's gradient. The automatic edge finding algorithm is then used to obtain the image vertex of the sample to be measured, the affine transformation is used for attitude correction, and the module matching approach is used to locate the diffuse reflection surface defect. The gray morphological opening and closing operation is used for the original image to obtain the morphology and position information of the defect. Finally, Adam optimizer is chosen as the gradient descent algorithm's optimizer. Experimental results show that the proposed approach can effectively improve the accuracy of diffuse reflection surface defect detection and reduce the economic cost of defect detection, which has a certain practical value.
Diffuse reflection occurs when light is reflected off a surface in such a way that an incident ray is reflected at several angles instead of just one, as in specular reflection . Lambertian reflectance describes the brightness of an illuminated ideal diffuse reflecting surface from all directions in the hemisphere around the surface. A surface made of a non-absorbing powder like plaster, fibres like paper, or a polycrystalline substance like white marble diffuses light very well. Many common materials reflect both specularly and diffusely . With the rapid development of modern industry, the production process of various types of industrial products is also gradually improving. The product surface processing process has gotten increasingly complicated as production capacity has increased. For example, new surface defects will appear in any link; the more the processing links, the higher the probability of surface defects. In each production link, if the products with surface defects flow into the next link, there will be more serious losses . Furthermore, as the public's purchasing power grows, there are more specific expectations for product performance and quality, as well as standards for product appearance . Therefore, on the basis of gradually higher requirements for the output and quality of products, only a simple spot check on the appearance of products cannot meet the market demand. At the present stage, most of the product processing manufacturers use the artificial naked eye to detect the appearance of products, while the human eye detection technique has a relatively slow detection speed and a low detection accuracy, which cannot meet the production needs of modern industry .
At the present, some technologies can only identify common surface flaws, and the only approach to get surface defects is to use basic lighting . Due to the complex appearance and many types of defects, light produces irregular diffuse reflection on the surface of more complex product surface defects, such as frosted surface defect detection of tablet mobile phones and defect detection of automobile body paint, resulting in the failure of imaging defects by ordinary lighting approaches . Diffuse reflection surface defect detection is mostly manual, and how to identify the diffuse reflection surface is an important topic that has to be solved . Therefore, this paper makes an in-depth study on the defect detection of diffuse reflection surface.
The innovations of this paper are as follows:(1)Gray code and four-step phase shift approach are mainly used to solve the absolute phase of the reflected image. The image defect is obtained using the absolute phase conversion gradient, affine transformation for attitude correction, module matching approach for diffuse reflection surface defect location, and gray morphological opening and closing operation for the original image to obtain the defect’s morphology and position information.(2)Simulation results demonstrate that the proposed technique can increase the accuracy of diffuse reflection surface defect detection while also lowering the cost of defect detection, which has some practical utility.
The remainder of this paper is structured as follows. In Section 2, related work about the proposed approach is presented. In Section 3, the diffuse reflection surface defect detection system is discussed. The machine learning-based detection of diffuse reflector defects is explained in Section 4. Section 5 contains analysis of experimental results. Finally, this paper is concluded in Section 6.
2. Related Work
Machine detection has progressively replaced manual detection and has become the major trend in defect detection, in order to overcome the limitations of traditional detection approaches. However, certain research findings have been accomplished. Xiong et al. proposed a defect detection approach based on reflection Moire image in order to solve the defect detection problem of polished workpiece surface. This approach relies on the difference in Moire polished surface reflections and the change in detection Moire image to detect and pinpoint existing faults. The illumination model of polished surface is analyzed in detail, the step effect of Moire edge is suppressed by castan algorithm, the surface defects are extracted by Gabor transform, and maximum entropy segmentation as well as the surface defects are detected and located. Experiments in the literature show that the proposed approach can effectively detect the deformation characteristic defects on the polished surface, and the detection rate of different types of surface defects is high. The proposed approach can configure the detection resolution individually, has a high adaptability to various types of defects, effectively improves detection expansibility, and successfully solves the problem of surface defect detection on polished workpieces with high reflection. However, this approach has the problem of high detection cost . Song et al. proposed a diffuse reflection fringe detection approach based on computer vision in order to solve the problem of diffuse reflection surface curve detection. This approach identifies the integrity of the fringes on the inner wall of the light source lit by the surface reflection based on surface diffuse reflectance and surface features, in order to determine whether the surface has faults. The diffuse reflection fringe detection system is made up of three major components: a computer, a camera, and a lighting source. The illumination light source in the experiment is a diffuse light source with stripes affixed to the inner wall. The camera looks through the illumination light source’s observation hole, captures the surface picture, and sends the black-and-white striped image to the computer for thorough discrimination. The experimental results show that the discrimination rate of the defect detection device using this approach for steel ball defects is 95.8%, which meets the basic requirements of detection. Although the discrimination rate is high, the accuracy of common defect detection on diffuse reflection surface is low . Gao et al. proposed a defect detection approach based on template matching and deep learning in order to solve the problem that the reflective surface has strong specular diffuse reflection characteristics. Under the condition of smooth diffuse illumination, the strip texture features are obtained from different angles, and the contour is obtained through image preprocessing and matched with the template of the standard feature contour for recognition. It can also obtain pictures making them into datasets and by using deep learning model to carry out defect recognition on the obtained images. The experimental results show that this approach can effectively identify the surface defects, but there is a problem of low recognition accuracy . Zhou proposed that in the actual production process, the surface of industrial products would produce various stains or marks, which will interfere with the defect recognition based on machine vision surface. Although the pattern statistics-based recognition approach is quick, it has weak anti-interference capabilities and a high rate of misjudgment. As a result, the technique and empirical formula for relevant parameter setting are offered, based on the improved SIFT algorithm. The experiment reveals that this approach has great anti-interference ability and resilience, and that the relevant parameter setting is also more accurate, using actual diffuse reflection surface defect detection. The approach has a greater economic cost due to the difficult defect identification procedure with this type of data .
3. Diffuse Reflection Surface Defect Detection System
The diffuse reflection surface defect detection system is composed of a display, reflective object, and camera, which is shown in Figure 1. The defect detection system mainly adopts the diffuse reflection approach illustrated in Figure 1. The diffuse reflection image is collected through the object surface by the structured light projected by the display and the camera . The three-dimensional information of the reflection surface is included in the diffuse reflection picture . Phase extraction and phase removal of the diffuse reflection picture may be used to get the gradient information of the diffuse reflection surface. At the defect, the phase shifts dramatically. The magnitude of the gradient shift can be used to establish whether it is a defect .
Figure 2(a) shows that when there is no surface reflection, point of the display is illuminated to emit light, which is reflected to point of the camera through the surface point. and denote the angle between diffuse reflected incoming light and diffuse reflected light and normal direction . Using the law of diffuse reflection, the coordinates of the pixel points corresponding to the display pixels of the charge-coupled device (CCD) can be traced backwards .
Figure 2(b) shows that if there is no defect in the detected surface, then the intensity signal that the CCD would receive is given as follows, where all diffuse reflected light is injected and released in parallel:where represents the total diffuse reflectance received by the CCD, represents the reflected light intensity of the surface before the diffuse reflection, represents the reflected light intensity of the surface after the diffuse reflection, and represents the step of phase shift, so each point is superimposed; as a result, the estimated phase information remains unchanged. Solving the phase of the emitted image is an important prerequisite for obtaining diffuse reflector defect image .
3.1. Phase Calculation
The camera using the original phase picture presented on the display determines the phase shift technique. By using sinusoidal stripes, assuming the phase shift approach is used, the expression of the diffuse reflected light intensity received by the camera iswhere represents the intensity of the image when diffuse reflection phase shifts by steps, most of which are known quantities obtained by the camera, represents the distribution of background intensity, represents the distribution of modulation, and phase indicates the solving of an unknown quantity. Therefore, the value of is 3, using least squares , calculated as
Since the function value of the arc tangent is , is the phase value which can be folded into range, as shown in Figure 3(a). The folded phase diagram includes numerous grayscale truncations, and the truncation and object overlap with the diffuse reflector defect, making it impossible to identify the diffuse reflector defect. As a result, the acquisition of the wrapping phase is expanded, resulting in phase unwrapping .
3.2. Phase Unwrapping
In order to acquire a continuous phase value, the technique of defining the period at the phase truncation is used .
The diffuse reflection map is assisted in selecting the Ray code map using the time-domain phase unwrapping approach. There is no error buildup since the phase unwrapping of Gray codes is dependent on the time series. When Gray codes are combined with phase shifting codes, the number of bits in the Gray codes is reduced, and the decoding speed is increased. Gray-code stripes encode the pixels in diffuse reflective images, mostly for defining the phase series, and phase-shifted sinusoidal reflective images for defining the wrapping phase, as shown in Figure 3(b).
The phase shift period cannot be less than times than the Gray code period, and represents the number of steps in the phase shift in order for the pixel points to be encoded. The phase series of the gray code and phase shift approach are used to define the wrapping phase , which are combined to get the continuous absolute phase:
Depending on the phase and gradient relationship, it can be concluded that the gradient distribution in the and directions of the diffuse reflective surface iswhere and represent the direction gradients of and while and represent the deflection angles in both directions of the diffuse reflective surface. and represent the phase difference between the absolute phase and the reference phase in both directions, and and represent the two direction periods while and represent the height between the diffuse reflector and the display.
Solving the absolute phase is inversely proportional to the diffuse reflector gradient, and the defect gradient changes as a result, allowing the gradient to represent the diffuse reflector defect .
4. Machine Learning-Based Detection of Diffuse Reflector Defects
The front surface scratches exhibit identical imaging on the reflected surface, as seen by the diffuse reflector defect map of the gradient transformation above. To overcome this problem, a machine learning approach for removing diffuse reflector imaging interference is presented. Image preprocessing and diffuse reflector defect detection are the two major processing approaches.
4.1. Diffuse Image Preprocessing
Despite the guide groove limitation, the sample to be examined will skew when transmitted on the guide rail. As shown in Figure 4, the pixel points of the image are traversed from top to bottom and from left to right in order to find the boundary points. The grayscale changes generally occur at the image boundary of diffuse reflection samples. The grayscale gradient determines whether a pixel point is a boundary point or not. By looking for the left boundary as an example, traverse the pixel points from left to right, taking the grayscale gradient from the starting point of a diffuse reflection image . The coordinate value of the point is recorded when the grayscale gradient is larger than the associated threshold, and the downward pixel traversal is conducted to acquire the coordinate value of the border point. Similarly, the coordinate values of the other three boundary points are obtained. The least squares method yields a coordinate fitting straight line, which acts as the four limits, while the junction of the four lines serves as the four corners of the diffuse reflection sample picture.
Affine transformation is a linear transformation between two-dimensional coordinates of two-dimensional coordinate values. Affine transformation possesses parallelism and flatness, which means it can map a straight line in a diffuse reflection image or a straight line in a diffuse reflection image. Figure 5 shows a diagram of an affine transformation, which can effectively translate, rotate, scale, and invert an image. Affine transformation is represented by matrix :where represents the new coordinates of the diffuse reflector and represents the old coordinates of the diffuse reflector. Since the transformation matrix has only six unknown parameters, the transformation matrix can be obtained by obtaining the right angle point mapping relationship.
Grayscale correction of diffuse reflected image background is used to adjust the image backdrop's uneven grayscale produced by light source illumination or sample shaking during rail transmission. Image acquisition approach is the line scan acquisition. The gray level change of the picture background is in the horizontal direction due to the unequal illumination of the light source, whereas the gray level change of the image background produced by dithering is along the straight direction. The correction scheme consists of averaging the gray values of each row or column and then calculating the compensation values that must be added to the row or pixel points in the column based on the gray values of the corrected target or compensated values that must be compensated for by the column.
4.2. Diffuse Reflector Defect Detection Based on Machine Learning
A diffuse reflective surface defect detection approach based on machine learning is proposed in this paper. By producing the image as a template, the morphology of the original image may be switched on and off. The defect's gray value is filtered, but the picture background's gray information is kept, resulting in a defect-free template. Image erosion and image expansion are the two most basic procedures in gray morphology. The main corrosion operations of images are that the structure elements are clearly defined in the region . Selecting the minimum difference between the image gray value and the structure elements gray value , the mathematical expression can be defined aswhere represents the result graph after the morphological operation of a grayscale image and represents the original diffuse reflection image. is a binary matrix and the defining domain of . It defines the location in the neighborhood that is included in the range of maximum operations.
In grayscale morphology, the image expansion operation is intented to find the maximum gray value of the selected image and the structure element in the structure element area, which is expressed mathematically as
The open operation of gray morphology is to erode the image first and then expand it, whereas the closed operation is the inverse. The open operation will relocate the region in the plane smaller than the peak of the structure element and preserve the area bigger than the peak of the structure element if the picture is regarded as a plane and the gray value of the pixel point indicates its height. In the diffuse reflection plane, the closed operation fills pits smaller than the structure element, while pits bigger than the structure element are easy to overlook. The basic goal of diffuse reflector defect detection is to extract the section of the suspected defect and categorise it using the classification module to determine if there is a defect.
In order to prepare the defect dataset, 6300 sample maps were collected at the factory production site for testing, and the defect pictures were divided into different defect types by manual judgment. The diffuse reflector defects are classified into four categories according to the defect morphology: heterochrome, scratch, concave, and convex edges. Furthermore, because dust and dirt on the sample's surface are more likely to be regarded for defects, leading in misjudgments, dirt are classed as defect kinds in order to efficiently separate the dirt from the genuine defect, while dirt are also classified as dirt, dust, and ink based on the dirt morphology. Table 1 represents the number of defects.
Adam optimizer is an adaptive learning rate gradient descent optimizer, which suggests that the mean attenuation of the historic gradient square exponent iswhere and represent estimates of first and second moments for the gradient while they are corrected to avoid sliding of the two mean values.
The formula for updating the diffuse reflector parameter is
Adam optimizer is used as diffuse reflector gradient descent algorithm optimizer to detect diffuse reflector defects.
5. Analysis of Experimental Results
To verify the validity of the diffuse reflector defect detection approach proposed in this paper, Adam gradient descent optimizer is selected as the network training optimizer. Table 2 represents experimental environment data.
The detection rate and detection time are compared using the approaches described in this research and typical diffuse reflector defect detection approaches, while the data results are presented in Tables 3–5, respectively. Only the following defects (heterochrome, scratch, concave, and convex) were chosen for comparative study in this paper because of the large number of different types of defects. Table 3 shows 60 images with heterochromatic defects and 90 images without defects. Table 4 shows 90 defect-free images and 60 defect images with various scratches. Table 5 shows 60 defect pictures (concave and convex) and 90 defect-free photos.
Table 3 shows that the detection success rate of diffuse reflector with heterochromatic defects is 98.1%, which is 10.6% higher than that of traditional approaches. The detection rate of diffuse reflector with scratch defects is 97.5%, which is 11.8% higher than that of traditional approaches. The detection rate of diffuse reflective surfaces with concave and convex defects is 98.3% using the approach proposed in this paper, which is 9.7% higher than that of traditional approaches. The time for each image detected by the approach presented in this paper is significantly lower than that of the traditional approaches. Therefore, the approach proposed in this paper has a relatively high efficiency of defect detection, and the detection effect is also obvious for small defects. Figure 6 shows the accuracy of the proposed approach compared with the traditional approach in identifying different types of defects.
As can be seen from Figure 6, the approaches presented in this paper have better recognition results for all kinds of common defects in diffuse reflector, especially for scratches and heterochromes, which are closer to 100%. Although ink defects are uncommon, they are more common than the traditional procedures. Therefore, the approach proposed in this paper can be used to accurately identify the defects of diffuse reflector, to improve the detection effect. 600 images containing various types of defect experiments are selected. Figure 7 shows the error detection rate of the diffuse reflector defect detection approach compared with the traditional approaches.
Analysis of Figure 7 shows that the approach proposed in this paper has a slightly higher false detection rate in diffuse reflector defect detection, but with the increase of the defect detection image, the false detection rate decreases gradually. The results show that the approaches mentioned in this paper can effectively improve the accuracy of defect detection. The error detection rate of traditional approaches is lower at the beginning, but with the gradual increase of defect detection images, the error detection rate of defect detection increases gradually, which leads to the lower accuracy of using traditional approaches for defect detection. Figure 8 shows the economic cost of diffuse reflector defect detection compared with traditional approaches.
The cost of diffuse facets defect detection varies due to the types of defects. From Figure 8, it can be seen that the economic cost of approach proposed in the paper to recognize eight typical defect kinds is lower than the previous approaches. Because the proposed approach mainly uses the Gray code and four-step phase shift approach to resolve the absolute phase of the reflected image. The absolute phase is transformed into gradient to get the image defect, which simplifies the steps of defect detection and achieves a higher detection accuracy. This shows that the approach proposed in this paper has certain practicability.
As opposed to specular reflection, diffuse reflection arises where light is reflected off a surface in such a manner that an incident ray is reflected at several angles instead of just one. The manufacturing process for different kinds of industrial items is gradually improving, especially to the fast expansion of contemporary industry. As manufacturing capacity has expanded, the product surface processing procedure has become more difficult. As a result, this research examines the defect detection of diffuse reflection surfaces in depth. To solve the absolute phase of the reflected image, the Gray code and four-step phase shift technique are generally utilized. To obtain the defect's morphology and position information, the image defect is obtained using the absolute phase conversion gradient, affine transformation for attitude correction, module matching approach for diffuse reflection surface defect location, and gray morphological opening and closing operation for the original image. The diffuse reflector defect detection approach proposed in this paper can meet the requirements of high detection rate and high accuracy. For industrial enterprises, this approach can improve the efficiency of industrial product detection and reduce labor costs, while helping industrial enterprises to better summarize and analyze the causes of defects, thereby improving the related process approaches and production processes.
The data used to support the findings of this study are available from the corresponding author upon request.
Conflicts of Interest
The authors declare that they have no conflicts of interest.
X. Gao, Y. H. Liu, and Y. R. Xu, “Reflective arc surface defect detection based on template matching and deep learning,” Transducer and Microsystem Technologies, vol. 39, no. 10, pp. 135–137, 2020.View at: Google Scholar
A. De Lorenzi Pezzolo, G. Valotto, and A. Quaranta, “Carbonate and silicate abundance indexing in coarse-grained river sediments using diffuse reflection infrared spectroscopy (DRIFTS) and ion-beam-induced luminescence (IBIL) spectroscopies,” Applied Spectroscopy, vol. 71, no. 6, pp. 1222–1230, 2017.View at: Publisher Site | Google Scholar