A surface defect detection device and method based on deep learning

By using automated light source adjustment and an improved convolutional neural network, the problem of cumbersome manual light source adjustment in existing technologies has been solved, achieving efficient and accurate surface defect detection.

CN115601296BActive Publication Date: 2026-07-21HUAINAN NORMAL UNIV
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HUAINAN NORMAL UNIV
Filing Date
2022-08-25
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

In existing deep learning-based surface defect detection methods, manually changing and adjusting the lighting device is cumbersome, resulting in large image errors and reducing the accuracy and efficiency of the detection software or device.

Method used

Design a surface defect detection device based on deep learning. It adopts an automated light source adjustment system, combined with image preprocessing and an improved convolutional neural network, to automatically adapt to different lighting methods for different products to be inspected, and uses an AdaBoost cascade classifier for defect identification.

Benefits of technology

It simplifies the light source adjustment operation, improves the realism and accuracy of the detected images, enhances detection efficiency and precision, and reduces the processing difficulty of the detection software.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115601296B_ABST
    Figure CN115601296B_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of surface defect detection, and particularly relates to a surface defect detection device and method based on deep learning, which comprises a box body, a transportation positioning module, an image acquisition module, an image preprocessing module and a deep detection image module. By setting the telescopic rod, rubber membrane and bulb, the shape of the rubber membrane is changed through the telescopic rod, the illumination angle of the bulb inside the rubber membrane is changed, the lighting mode of the first light source is changed, different types of products to be detected are adapted, compared with the existing manual replacement and adjustment of the lighting device, the application is simple to operate, can reduce the difficulty of image processing of the detection software, improve the authenticity of the image of the product to be detected, and improve the detection accuracy and detection efficiency of the detection software and the detection device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of surface defect detection technology, specifically a surface defect detection device and method based on deep learning. Background Technology

[0002] Rapid industrialization has led to increasingly higher quality requirements for products. During the production process, product surfaces often develop defects, making surface defect detection a crucial step in the manufacturing process. Traditional manual inspection relies on human observation of the product surface, but some defect features are not obvious, resulting in large detection errors and low efficiency. Therefore, deep learning-based surface defect detection methods have emerged. For existing deep learning-based surface defect detection methods, the general detection process is as follows: under the illumination of a lighting device, an industrial camera captures images of surface defects on the product. The captured image information needs to be preprocessed by detection software. Finally, an improved convolutional neural network is used to extract features and classify the defect images to determine the authenticity of the defect images and to categorize the types of defects. However, in our practical application of deep learning-based surface defect detection methods, we found that appropriate lighting can reduce the processing difficulty of the detection software, while inappropriate lighting can cause overexposure, glare, and shadows in the images. Different products to be inspected require different lighting methods. Existing technologies allow for manual replacement and adjustment of lighting devices to match the lighting method to the product being inspected. However, this method is cumbersome and may lead to errors in the image surface, thereby reducing the accuracy and efficiency of the detection software or device.

[0003] Based on this, the present invention designs a surface defect detection device and detection method based on deep learning to solve the above-mentioned technical problems. Summary of the Invention

[0004] To address the shortcomings of existing methods that involve cumbersome manual replacement and adjustment of lighting devices, which can lead to errors in the images of the products under inspection and consequently reduce the accuracy and efficiency of the inspection software or device, this invention proposes a surface defect detection device and method based on deep learning.

[0005] The technical solution adopted by this invention to solve its technical problem is: a surface defect detection device based on deep learning, comprising: Box; The transportation positioning module includes a positioning turntable, a photoelectric switch, and a drive shaft. The positioning turntable is rotatably connected inside the housing, and the photoelectric switch and drive shaft are connected to the positioning turntable via wires to transport the product to be tested to the photography position via the positioning turntable. The image acquisition module includes a primary light source, an industrial camera, a secondary light source, and a support mechanism. The support mechanism is fixedly connected inside the housing and is evenly distributed around the positioning turntable. An expansion joint is fixedly connected to the inner side of the vertical support mechanism, and the primary light source is fixedly connected to the end of the expansion joint. The industrial camera and the secondary light source are located on the upper and lower sides of the primary light source, and the central axes of the primary light source, the secondary light source, and the industrial camera are on the same straight line. The secondary light source is fixedly connected to the inner side of the horizontal part of the support mechanism. The image preprocessing module is used to perform preprocessing operations on the original image, including grayscale processing, filtering and noise reduction, edge detection, morphological transformation and hole filling. The depth detection image module is used to analyze and process the preprocessed image through deep learning algorithms and deep learning models, and finally give the product surface defect detection results.

[0006] Preferably, the first light source consists of a first fixing plate, a rubber membrane, a second fixing plate, a telescopic rod, and a light bulb. The first fixing plate and the second fixing plate are fixedly connected to the end of the telescopic device, and the two ends of the rubber membrane are fixedly connected to the first fixing plate and the second fixing plate, respectively. One end of the telescopic rod is fixedly connected to the first fixing plate, and the other end is fixedly connected to the outside of the rubber membrane. A light bulb is fixedly connected to the inside of the rubber membrane, and the light bulb is configured to be connected in parallel inside the rubber membrane.

[0007] A surface defect detection method based on deep learning, applicable to the aforementioned surface defect detection device based on deep learning, and comprising: S1: Plug in the power and start the detection software and device through the keyboard and mouse peripherals, and start the industrial control computer outside the box. The industrial control computer controls the drive shaft to rotate through the photoelectric switch, so that the drive shaft drives the positioning turntable to rotate. The product to be tested placed on the positioning turntable rotates together with the positioning turntable. When the sensor on the support mechanism detects that the product to be tested has reached the designated area, the sensor transmits the signal to the industrial control computer. S2: After the detection device is turned on, the industrial control computer controls the first and second light sources to turn on, and controls the industrial camera to capture images of the product to be detected. Then, the obtained images of the product to be detected are transmitted to the industrial control computer, so that the detection software in the industrial control computer can preprocess the images. S3: The detection software first performs grayscale conversion, filtering and noise reduction, and edge detection on the image to remove influencing factors and enhance the image contour or edge details. Then, it performs suspected defect detection on the preprocessed image. If no suspected defects are detected, the image is not processed and is directly transmitted to the display screen. Otherwise, if a suspected defect is detected, the image needs to be processed for accurate defect detection and identification. S4: An improved convolutional neural network is used to extract features and classify images with surface defects. The convolutional layer is inspired by the concept of local receptive fields to extract features. Then, the pooling layer reduces the data dimensionality. Finally, the extracted features are classified by an AdaBoost cascade classifier to determine whether the suspected defective image is real or fake and to classify the types of defects. Attached Figure Description

[0008] The invention will now be further described with reference to the accompanying drawings.

[0009] Figure 1 This is a process flow diagram of the surface defect detection method based on deep learning in this invention; Figure 2 This is a block diagram of the surface defect detection method based on deep learning in this invention; Figure 3 This is a block diagram of the image preprocessing module and the depth detection image module in this invention; Figure 4 This is a perspective view of the surface defect detection device based on deep learning in this invention; Figure 5 for Figure 4 Schematic diagram of the relevant structure of the central support mechanism; Figure 6 for Figure 4 Schematic diagrams of the structures in Embodiment 1 and Embodiment 2; Figure 7 for Figure 4 Schematic diagram of the structure in Embodiment 3; Figure 8 for Figure 4 Schematic diagram of the structure in Example 4; In the diagram: 1. Housing; 2. Positioning turntable; 21. Drive shaft; 3. Light source 1; 31. Industrial camera; 32. Light source 2; 33. Support mechanism; 331. Telescopic device; 34. Fixing plate 1; 341. Rubber membrane; 342. Fixing plate 2; 343. Telescopic rod; 344. Light bulb. Detailed Implementation

[0010] To make the objectives, technical means, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention are described clearly and completely. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0011] To better understand the above technical solutions, the following will provide a detailed explanation of the technical solutions in conjunction with the accompanying drawings and specific implementation methods.

[0012] like Figures 1 to 8 As shown, the surface defect detection device based on deep learning according to the present invention includes: Box 1; The transportation positioning module includes a positioning turntable 2, a photoelectric switch, and a drive shaft 21. The positioning turntable 2 is rotatably connected inside the housing 1, and the photoelectric switch and drive shaft 21 are connected to the positioning turntable 2 via wires to transport the product to be tested to the photography position via the positioning turntable 2. The image acquisition module includes a primary light source 3, an industrial camera 31, a secondary light source 32, and a support mechanism 33. The support mechanism 33 is fixedly connected inside the housing 1 and is evenly distributed around the positioning turntable 2. A telescopic device 331 is fixedly connected to the inner side of the vertical support mechanism 33, and the primary light source 3 is fixedly connected to the end of the telescopic device 331. The industrial camera 31 and the secondary light source 32 are located on the upper and lower sides of the primary light source 3, and the central axes of the primary light source 3, the secondary light source 32, and the industrial camera 31 are on the same straight line. The secondary light source 32 is fixedly connected to the inner side of the horizontal part of the support mechanism 33. The image preprocessing module is used to perform preprocessing operations on the original image, including grayscale processing, filtering and noise reduction, edge detection, morphological transformation and hole filling. The depth detection image module is used to analyze and process the preprocessed image through deep learning algorithms and deep learning models, and finally give the product surface defect detection results.

[0013] like Figures 4 to 8 As shown, the first light source 3 consists of a first fixing plate 34, a rubber membrane 341, a second fixing plate 342, a telescopic rod 343, and a bulb 344. The first fixing plate 34 and the second fixing plate 342 are fixedly connected to the ends of the telescopic device 331. The two ends of the rubber membrane 341 are fixedly connected to the first fixing plate 34 and the second fixing plate 342, respectively. One end of the telescopic rod 343 is fixedly connected to the first fixing plate 34, and the other end is fixedly connected to the outside of the rubber membrane 341. A bulb 344 is fixedly connected to the inside of the rubber membrane 341, and the bulbs 344 are arranged in parallel inside the rubber membrane 341.

[0014] Using the above-mentioned detection device, the detection is carried out according to the following steps: S1: Plug in the power and start the detection software and device through the keyboard and mouse peripherals, and start the industrial control computer outside the housing 1. The industrial control computer controls the drive shaft 21 to rotate through the photoelectric switch, so that the drive shaft 21 drives the positioning turntable 2 to rotate. The product to be tested placed on the positioning turntable 2 rotates together with the positioning turntable 2. When the sensor on the support mechanism 33 detects that the product to be tested has reached the designated area, the sensor transmits the signal to the industrial control computer. S2: After the detection device is turned on, the industrial control computer controls the first light source 3 and the second light source 32 to turn on, and controls the industrial camera 31 to capture the product to be detected. Then, the obtained image of the product to be detected is transmitted to the industrial control computer, so that the detection software in the industrial control computer can preprocess the image. S3: The detection software first performs grayscale conversion, filtering and noise reduction, and edge detection on the image to remove influencing factors and enhance the image contour or edge details. Then, it performs suspected defect detection on the preprocessed image. If no suspected defects are detected, the image is not processed and is directly transmitted to the display screen. Otherwise, if a suspected defect is detected, the image needs to be processed for accurate defect detection and identification. S4: An improved convolutional neural network is used to extract features and classify images with surface defects. The convolutional layer is inspired by the concept of local receptive fields to extract features. Then, the pooling layer reduces the data dimensionality. Finally, the extracted features are classified by an AdaBoost cascade classifier to determine whether the suspected defective image is real or fake and to classify the types of defects.

[0015] Specific workflow: like Figures 2 to 3 As shown, the detection software and detection device are started via keyboard and mouse peripherals, and the industrial control computer controls the drive shaft 21 to rotate via photoelectric switch, thereby causing the drive shaft 21 to drive the positioning turntable 2 to rotate. The product to be tested is transported into the housing 1 via an external transmission belt and transported to the surface of the positioning turntable 2, rotating together with the positioning turntable 2. At the same time, the industrial control computer controls the first light source 3 and the second light source 32 to be turned on. The edge of the positioning turntable 2 moves between the first light source 3 and the second light source 32. The positioning turntable 2 is made of glass. The second light source 32 is used to illuminate the back of the product to be tested, thereby increasing the brightness around the product. The first light source 3 is used to illuminate the front of the product to be tested. The shape of the rubber membrane 341 is changed by controlling the telescopic rod 343, thereby changing the illumination angle of the bulb 344 inside the rubber membrane 341, thus changing the illumination mode of the first light source 3. Sensors are installed on the support mechanism 33. When the positioning turntable 2 moves the product to be inspected between the first light source 3 and the second light source 32, the sensors transmit signals to the industrial control computer. The control computer then controls the industrial camera 31 to capture images of the product to be inspected. The obtained image of the product to be inspected is then transmitted to the industrial control computer, where the inspection software performs preprocessing on the image. By performing grayscale conversion, filtering and noise reduction, and edge detection on the image of the product to be inspected, factors that could affect the detection of defects in the original image are removed, and the image contour or edge detail information is enhanced. Then, the preprocessed image is subjected to suspected defect detection. If no suspected defect is detected, the image is not processed and is directly transmitted to the display screen. Otherwise, if a suspected defect is detected, the image needs to be processed for accurate defect detection and identification. The detection software uses an improved convolutional neural network to analyze images of suspected surface defects. The images of suspected defects are processed through convolutional layers, pooling layers, and fully connected layers. The convolutional layers extract features from small regions of the image. Once the features of a small region are extracted, its positional relationship with other features can be determined. The pooling layer reduces the output of the convolutional layer, reducing pixel information irrelevant to the features, thus preserving important feature information. Then, the feature information enters the fully connected layer, where a fully connected layer and an AdaBoost cascade classifier are used to identify and classify the feature information, thereby determining whether the suspected defect image surface actually has a defect and facilitating the classification of defect types.

[0016] In the process of inspecting products, proper lighting can reduce the processing difficulty of the inspection software, while improper lighting can cause overexposure, glare, and shadows in the image, thereby increasing the recognition difficulty of the inspection software. Different products require different lighting methods.

[0017] Example 1; like Figure 6 As shown, when the surface area of ​​the product to be inspected is large, the industrial control computer controls the telescopic rod 343 to move downward, causing the telescopic rod 343 to drive the rubber diaphragm 341 to deform downward until the rubber diaphragm 341 forms an L-shape in cross-section. The bulbs 344 inside the rubber diaphragm 341 are connected in parallel. At this time, some bulbs 344 are in a horizontal state inside the rubber diaphragm 341, and the other part of the bulbs 344 are in a vertical state inside the rubber diaphragm 341. The industrial control computer controls the horizontal bulbs 344 to start and the vertical bulbs 344 to turn off. The lighting mode of the bulbs 344 is vertical illumination. Thus, the lighting mode of the first light source 3 has the effect of large illumination area and good light uniformity. The products to be inspected include, for example, substrates, circuit boards and crystal components for defect inspection.

[0018] Example 2: like Figure 6As shown, when there are scratches or protrusions on the surface of the product to be tested, the shape of the rubber film 341 is the same as in Embodiment 1. The difference is that the industrial control computer controls the horizontal bulb 344 to be turned off and the vertical bulb 344 to be turned on. The industrial control computer drives the first light source 3 to move downward and closer to the surface of the product to be tested through the telescopic device 331, so that the distance between the first light source 3 and the second light source 32 is reduced. The light source 344 illuminates at a low angle. Therefore, the above-mentioned illumination method of the first light source 3 has a good ability to detect surface scratches or protrusions, such as scratches on wafers or glass substrates of the product to be tested.

[0019] Example 3: like Figure 7 As shown, when the product to be inspected has holes or markings, the industrial control computer uses the telescopic rod 343 to drive the rubber diaphragm 341 to deform upwards, causing the rubber diaphragm 341 to form an inclined straight line on the cross-section. The angle of inclination can be adjusted to 30°, 60° or 75° by the telescopic rod 343. At the same time, the industrial control computer controls the bulb 344 inside the rubber diaphragm 341 to turn on. The bulb 344 illuminates at an angle. Thus, the above-mentioned illumination method of the first light source 3 has the characteristics of high beam concentration, good brightness and uniformity. The products to be inspected include plastic containers, screw holes in workpieces and printed markings on integrated circuits.

[0020] Example 4: like Figure 8 As shown, when the surface of the product to be inspected has a curvature, the industrial control computer drives the rubber membrane 341 to deform upward through the telescopic rod 343, so that the rubber membrane 341 forms a semi-arch shape in the cross section, and the bulb 344 forms different angles inside the rubber membrane 341. When the industrial control computer controls the bulb 344 inside the rubber membrane 341 to turn on, the bulb 344 illuminates the product to be inspected with light at different angles. The lighting method of the bulb 344 is multi-angle illumination. Thus, the lighting method of the first light source 3 has the function of extracting three-dimensional information of the product to be inspected, such as a circuit board solder component.

[0021] In summary, by changing the shape of the rubber membrane 341 through the telescopic rod 343, the illumination angle of the bulb 344 inside the rubber membrane 341 is changed, thereby changing the lighting mode of the first light source 3. This allows it to adapt to different types of products to be inspected. Compared with existing manual replacement and adjustment lighting devices, this invention is simple to operate, reduces the difficulty of image processing by the inspection software, improves the authenticity of the images of the products to be inspected, and improves the inspection accuracy and efficiency of the inspection software and inspection device.

[0022] In one embodiment of the present invention, in S2, the first light source 3 and the second light source 32 are set as LED lights, the second light source 32 is set as a surface light source, and the light color of the LED lights is set to red, green, blue and white.

[0023] In this invention, both light source 3 and light source 32 use LED lights. According to the following experimental table, although halogen lamps and xenon lamps have high brightness, they are significantly inferior to LEDs in terms of lifespan, flexibility, heat generation, response speed, and cost-effectiveness. Fluorescent lamps are generally inferior to other types of lights. Therefore, LEDs are selected as industrial light sources to adapt to different products to be tested and different occasions. led 6 6 3 6 5 5 fluorescent lamp 3 2 4 2 3 3 halogen lamp 2 3 4 2 4 6 Xenon lamps 3 4 5 5 3 6 Light source 3 changes according to the product being inspected, while light source 32 is set as a surface light source to enhance the illumination of the back of the product being inspected. Currently, the LED lights used in inspection have red, green, blue, and white colors. The required light color may also be different for different products being inspected. For example, when the product being inspected is a metal material, the LED light color should be set to white. Since the metal surface coating is black or blackish, while metal is usually bright white, if there is damage to the metal surface, the coating will show its original color. Under the illumination of white light, the defective areas on the metal surface will be particularly prominent. Therefore, by setting the type and color of the light, the quality of the image acquired by the industrial camera 31 can be further improved, and the inspection efficiency of the inspection software and inspection device can be accelerated.

[0024] In one embodiment of the present invention, in S2, the grayscale conversion method includes weighted method, maximum value method, and average value method. The present invention uses the weighted average value method to convert the RGB three-channel image into a single-channel grayscale image, thereby reducing the computational resources and time consumed during convolution operations. In S2, the filtering methods include mean filtering, median filtering, and Gaussian filtering. This invention uses a Gaussian filtering algorithm to restore or reconstruct the image, thereby eliminating noise in the image and reducing interference from noise with subsequent algorithms. In S2, the image edge detection methods include Roberts edge detection, Sobel edge detection, and Canny edge detection. This invention uses the Canny edge detection method to alleviate the image contour blurring phenomenon, thereby reducing the occurrence of situations where missing contour edge information affects the important information needed for the initial screening of defects.

[0025] In this invention, grayscale conversion methods include weighted method, maximum value method, and average value method. The maximum value method compares the pixel values ​​of the RGB three channels and uses the maximum value as the grayscale value of the single-channel grayscale image. This method results in an overall larger grayscale value, a brighter overall image, and an overly prominent background, making subsequent processing difficult. The average value method uses the average of the RGB three-channel color brightness values ​​as the grayscale value of the single-channel grayscale image. This method softens the image and reduces its contrast. The weighted method uses different scaling factors to convert the RGB three-channel image into a single-channel grayscale image. This method converts various RGB images into single-channel grayscale images, reduces the disadvantages of the maximum value method and the average value method, and helps to achieve the integrity of image grayscale conversion. Industrial cameras (31) can introduce noise into images due to factors such as sensor quality, temperature, or environmental conditions. This noise weakens texture, edges, and details, necessitating image denoising. Appropriate algorithms are used to restore or reconstruct the image, eliminating noise. Filtering methods include mean filtering, median filtering, and Gaussian filtering. Mean filtering involves defining a region using a filter and replacing the original image's grayscale value with the average grayscale value of all pixels within that region. This method can eliminate noise caused by abrupt changes in grayscale values; however, it can also cause variations in image quality. The degree of blurring varies; median filtering replaces the grayscale value of the original image with the median value of all pixels in the region. This method can effectively remove noise points and make grayscale values ​​of different levels approach the same, but it will also cause the image to blur, although the degree of blurring is less than that of mean filtering; Gaussian filtering involves scanning each pixel value in the image, then calculating the average value of the pixel value and its neighboring pixel values ​​through weighting, and then using the average value to replace the grayscale value of the original image, thereby eliminating noise points in the image. Although it will also make the image blurry, this method can preserve the image's detail information to the greatest extent. Image blurring is corrected using edge detection methods, including Roberts edge detection, Sobel edge detection, and Canny edge detection. Roberts edge detection uses local difference operators and is effective for vertical edges, but it is sensitive to noise. Sobel edge detection uses highly divergent differential operators and calculates edges based on the difference in gray values ​​of adjacent points, but it requires sophisticated lighting and high-quality filtering and denoising templates. Canny edge detection uses four steps: denoising, calculating image gradient magnitude, non-maximum suppression, and double threshold detection. This method is highly resistant to noise and produces clear image edges. In summary, image preprocessing through grayscale conversion, filtering and noise reduction, and edge detection removes irrelevant components and enhances image contour edge information. This reduces the loss of defect information caused by direct image compression, thereby improving the detection efficiency of detection software and devices.

[0026] In one embodiment of the present invention, in S3, the improved convolutional neural network uses a Dropout layer to replace the linear model in order to reduce the occurrence of overfitting and reduce the training time of deep neural networks, thereby improving the robustness of the neural network.

[0027] In S3, the training method of the improved convolutional neural network is the backpropagation algorithm, which includes forward propagation and backpropagation, wherein backpropagation mainly uses the loss function for calculation.

[0028] In S4, the improved convolutional neural network introduces a transfer learning method during training, and since the AdaBoost cascade classifier is a support vector machine, the AdaBoost cascade classifier replaces the traditional Softmax classifier.

[0029] In this invention, because some defects are subtle or highly similar, it increases the difficulty of extracting feature information. Furthermore, because convolutional neural networks have many layers, later layers tend to discard shallow features from earlier layers, or the layers may be too shallow to fully extract the main features of the defects, which can affect the final recognition accuracy and lead to overfitting. Generally, convolutional neural networks use linear models to address overfitting. However, this invention uses Dropout layers to replace linear models. Dropout reduces the internal connections between neurons in a neural network, thereby reducing overfitting. This is achieved by combining neurons and then training the combined neural network, making each training neural network different. Finally, the combined networks are merged to form the overall neural network. This method can improve the robustness of the neural network. The neural network is trained using the backpropagation algorithm, which includes forward propagation and backward propagation. Forward propagation involves inputting data into the neural network, performing hidden layer calculations, and finally outputting the neural network. The algorithm is as follows: ; ; in, It is the activation value of the i-th neuron in the l-th layer. This represents the number of neurons in the l-th layer. Indicates the first lThe weights from the j-th neuron in layer -1 to the i-th neuron in layer l. This represents the bias of the i-th neuron in the l-th layer. This represents the weighted sum of the inputs to the i-th neuron in the l-th layer; Backpropagation primarily uses a loss function to calculate the error between the output and the true value, and then updates the parameters of each layer in the neural network. Gradient optimization algorithms are typically used to update the parameters of each layer, and its loss function is: Assuming the sample is , ; in, This is the output of the neural network, where W and b are the parameters in the neural network, and the overall loss function is: ; Where n represents the total number of layers in the neural network, and the parameters... It serves to measure the relative importance of the two items; Furthermore, transfer learning is introduced into convolutional neural networks. Transfer learning allows for retraining based on a pre-trained model, serving as a pre-trained model for subsequent training. This accelerates network convergence and reduces overfitting. Simultaneously, to further train and classify feature information, an AdaBoost cascade classifier replaces the traditional Softmax classifier. While both are used to solve multi-classification problems, the Softmax classifier does not further classify the network's output features, while the AdaBoost cascade classifier (support vector machine) helps partition the feature space and maps it to a higher-dimensional space using kernel functions. This accelerates the resolution of non-linear classification problems, highlighting local features of surface defects on the product under inspection, thereby enhancing defect identification and improving the efficiency and accuracy of inspection software and devices.

[0030] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of the present invention is defined by the appended claims and their equivalents.

Claims

1. A surface defect detection device based on deep learning, characterized in that, include: Box; The transportation positioning module includes a positioning turntable, a photoelectric switch, and a drive shaft. The positioning turntable is rotatably connected inside the housing, and the photoelectric switch and drive shaft are connected to the positioning turntable via wires to transport the product to be tested to the photography position via the positioning turntable. The image acquisition module includes a primary light source, an industrial camera, a secondary light source, and a support mechanism. The support mechanism is fixedly connected inside the housing and is evenly distributed around the positioning turntable. An expansion joint is fixedly connected to the inner side of the vertical support mechanism, and the primary light source is fixedly connected to the end of the expansion joint. The industrial camera and the secondary light source are located on the upper and lower sides of the primary light source, and the central axes of the primary light source, the secondary light source, and the industrial camera are on the same straight line. The secondary light source is fixedly connected to the inner side of the horizontal part of the support mechanism. The image preprocessing module performs preprocessing operations on the original image, including grayscale processing, filtering and noise reduction, edge detection, morphological transformation, and hole filling. The depth detection image module is used to analyze and process the preprocessed image through deep learning algorithms and deep learning models, and finally give the product surface defect detection results. The first light source consists of a first fixing plate, a rubber membrane, a second fixing plate, a telescopic rod, and a light bulb. The first fixing plate and the second fixing plate are fixedly connected to the end of the telescopic device, while the two ends of the rubber membrane are fixedly connected to the first fixing plate and the second fixing plate, respectively. One end of the telescopic rod is fixedly connected to the first fixing plate, and the other end is fixedly connected to the outside of the rubber membrane. A light bulb is fixedly connected to the inside of the rubber membrane. When the surface area of ​​the product to be tested is large, the industrial control computer controls the telescopic rod to move downward, causing the telescopic rod to deform the rubber membrane downward until the rubber membrane forms an L shape in the cross section. At this time, some of the bulbs are in a horizontal state inside the rubber membrane, and the other part of the bulbs are in a vertical state inside the rubber membrane. The industrial control computer controls the horizontal bulbs to start and the vertical bulbs to turn off. The bulbs illuminate vertically, forming the effect of a large illumination area and good light uniformity of the No. 1 light source. When the product to be inspected has holes or markings, the industrial control computer uses a telescopic rod to deform the rubber membrane upwards, causing the rubber membrane to form an inclined straight line on the cross-section. The angle of inclination can be adjusted to 30°, 60° or 75° by the telescopic rod. At the same time, the industrial control computer controls the bulb inside the rubber membrane to turn on. The bulb illuminates at an angle, forming a lighting method with high beam concentration, good brightness and uniformity. When the surface of the product to be inspected has a curvature, the industrial control computer drives the rubber membrane to deform upward through the telescopic rod, so that the rubber membrane forms a semi-arch shape in the cross section, and the bulb forms different angles inside the rubber membrane. When the industrial control computer controls the bulb inside the rubber membrane to turn on, the bulb illuminates the product to be inspected with light at different angles. The bulb's lighting method is multi-angle illumination, forming a lighting method of the No. 1 light source, which has the function of extracting three-dimensional information of the product to be inspected.

2. A surface defect detection method based on deep learning, characterized in that: This method is applicable to the deep learning-based surface defect detection device described in claim 1, and the method includes: S1: Plug in the power and start the detection software and device through the keyboard and mouse peripherals, and start the industrial control computer outside the box. The industrial control computer controls the drive shaft to rotate through the photoelectric switch, so that the drive shaft drives the positioning turntable to rotate. The product to be tested placed on the positioning turntable rotates together with the positioning turntable. When the sensor on the support mechanism detects that the product to be tested has reached the designated area, the sensor transmits the signal to the industrial control computer. S2: After the detection device is turned on, the industrial control computer controls the first and second light sources to turn on, and controls the industrial camera to capture images of the product to be detected. Then, the obtained images of the product to be detected are transmitted to the industrial control computer, so that the detection software in the industrial control computer can preprocess the images. S3: The detection software first performs grayscale conversion, filtering and noise reduction, and edge detection on the image to remove influencing factors and enhance the image contour or edge details. Then, it performs suspected defect detection on the preprocessed image. If no suspected defects are detected, the image is not processed and is directly transmitted to the display screen. Otherwise, if a suspected defect is detected, the image needs to be processed for accurate defect detection and identification. S4: An improved convolutional neural network is used to extract features and classify images with surface defects. The convolutional layer is inspired by the concept of local receptive fields to extract features. Then, the pooling layer reduces the data dimensionality. Finally, the extracted features are classified by an AdaBoost cascade classifier to determine whether the suspected defective image is real or fake and to classify the types of defects.

3. The surface defect detection method based on deep learning according to claim 2, characterized in that: In S2, light source one and light source two are set as LED lights, and the LED lights are set to red, green, blue and white.

4. The surface defect detection method based on deep learning according to claim 2, characterized in that: In S2, the grayscale conversion uses a weighted average method to convert the RGB three-channel image into a single-channel grayscale image, in order to reduce the computational resources and time consumed during convolution operations.

5. The surface defect detection method based on deep learning according to claim 4, characterized in that: In S2, a Gaussian filtering algorithm is used to restore or reconstruct the image in order to eliminate noise in the image and reduce the interference of noise on subsequent algorithms.

6. The surface defect detection method based on deep learning according to claim 5, characterized in that: In S2, the image edges are mitigated by the Canny edge detection method to reduce the occurrence of missing contour edge information that affects the important information needed for the initial screening of defects.

7. The surface defect detection method based on deep learning according to claim 2, characterized in that: In S3, the improved convolutional neural network uses a Dropout layer to replace the linear model in order to reduce overfitting and reduce the training time of deep neural networks.

8. The surface defect detection method based on deep learning according to claim 7, characterized in that: In S3, the training method for the improved convolutional neural network is the backpropagation algorithm, which includes forward propagation and backpropagation.

9. The surface defect detection method based on deep learning according to claim 8, characterized in that: In S4, the improved convolutional neural network introduces transfer learning during training and replaces the traditional Softmax classifier with the AdaBoost cascade classifier.