A surface defect detection method based on channel enhancement and feature reconstruction

By using a three-channel feature reconstruction technique to randomly enhance and smooth the R, G, and B channels of the image, the problem of data scarcity and background interference in surface defect detection of the YOLO algorithm is solved, thereby improving detection accuracy and robustness.

CN120298374BActive Publication Date: 2025-11-25CHONGQING UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510436839.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-09
Publication Date
2025-11-25
Estimated Expiration
2045-04-09

AI Technical Summary

Technical Problem

Existing YOLO series algorithms have problems in surface defect detection, such as difficulty in collecting training data samples and a small number of samples. Furthermore, the surface defect features are not obvious and complex texture interference leads to insufficient detection accuracy. In particular, it is difficult to effectively distinguish between defects and background under changes in lighting and background interference.

Method used

A three-channel feature reconstruction technique is adopted to perform random channel feature enhancement and Gaussian smoothing on the R, G, and B channels of the image, respectively. A fused image is generated by weighted fusion to enhance the contrast of defect features and suppress background texture. The YOLO network is then used for detection.

Benefits of technology

It significantly improves the model's generalization ability and robustness, enhances the defect detection rate and accuracy, reduces background noise interference, and strengthens the ability to identify minute defects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120298374B_ABST
    Figure CN120298374B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of surface defect detection, and specifically relates to a surface defect detection method based on channel enhancement and feature reconstruction, comprising: obtaining an original image; processing any channel image of the original image through a random channel feature enhancement mode to obtain an enhanced channel image; performing Gaussian smoothing on any channel image of two channel images of the original image that have not been selected to obtain a background texture suppression channel image; performing balanced brightness processing on the last channel image that has not been processed to obtain a brightness balanced channel image; performing weighted fusion on the enhanced channel image, the background texture suppression channel image and the brightness balanced channel image to obtain a fused image; inputting the fused image into a trained defect detection model to obtain a detection result, wherein the defect detection model is constructed using a YOLO network; the present application separates the background and defect features, applies a suppression weight to the background features in different channels, reduces the interference of background noise on defect recognition, and improves the accuracy of detection.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of surface defect detection, and particularly relates to a surface defect detection method based on channel enhancement and feature reconstruction. BACKGROUND

[0002] Surface defect detection is an extremely important application field in manufacturing quality control. With the improvement of manufacturing automation, higher and higher requirements are put forward for surface defect detection on production lines. Traditional surface defect detection methods mainly rely on machine vision algorithms, and the basic principle is to obtain the surface image of the detected object through cameras, optical sensors, etc., and to identify defects by using image processing techniques. Image processing techniques mainly include edge detection, texture analysis, gray histogram analysis, morphological processing, template matching, Hough transform, etc. However, these methods have common limitations, such as insufficient detection capability for complex textures, sensitivity to light changes, limited recognition accuracy for small defects, etc. In recent years, the successful application of deep learning in computer vision has made surface defect detection methods based on convolutional neural networks (CNN) gradually become mainstream. CNN can automatically learn multi-level feature representations of images, thereby maintaining high detection accuracy in complex environments. Among them, the YOLO algorithm series is particularly suitable for real-time monitoring and large-scale production line surface defect detection scenarios due to its fast and efficient detection capability.

[0003] Although the YOLO series of target detection deep learning algorithms have more advantages than traditional image processing algorithms in the application of ceramic bottle defect detection, the YOLO series of algorithms, especially the YOLOv8 algorithm, are still subject to the number of training data and the quality of defect features, and still have many problems:

[0004] 1) Difficulty in collecting training data samples and insufficient number of samples: In actual production, surface defects (such as black and white spots, color bars, pits, bulges, oil stains, indentations, etc.) are usually sporadic and randomly distributed, making it very difficult to obtain enough defect samples. At the same time, the production line is large, and real-time acquisition of high-resolution image data requires expensive equipment and complex arrangement, and manual annotation of defect data is also very time-consuming. In addition, some defect types may occur very rarely, which can cause the model to easily overfit to the frequently occurring categories during training, and the defect detection effect for rare categories is poor.

[0005] 2) The problem that the surface defect features are not obvious: the material surface usually has complex and irregular textures, the strength and morphology of which can be very similar to the defect area, making it difficult to effectively distinguish the defect; moreover, the defect area can only occupy a small part (0.1 mm in diameter) of the image, and the morphology has a high degree of variability, such as black and white spots, lines, pits, and bumps. Changes in lighting conditions (such as light and shadow, reflection, etc.) can mask or obscure the defect features, further exacerbating the detection difficulty.

[0006] 3) The problem of background interference after the surface irregularities are enhanced: when the defect features are enhanced, the irregularities can also be enhanced, making it more difficult for the model to distinguish between defects and background irregularities. Moreover, the irregularities on the surface contain a large amount of high-frequency information (such as edges and lines), which can be mistaken for defect features after enhancement, thereby increasing the false positive rate of detection. In addition, a large number of invalid or noise features can be introduced during the enhancement process, further interfering with the model's judgment. SUMMARY

[0007] To solve the above problems, the present application provides a surface defect detection method based on channel enhancement and feature reconstruction, and the specific scheme includes the following steps:

[0008] S1. Obtain an original image;

[0009] S2. Process any channel image of the original image by a random channel feature enhancement method to obtain an enhanced channel image;

[0010] S3. Perform Gaussian smoothing on any channel image of the two channel images of the original image that have not been selected in step S2 to obtain a background texture suppression channel image;

[0011] S4. Perform balanced brightness processing on the last channel image that has not been processed to obtain a brightness balanced channel image;

[0012] S5. Weighted fusion of the enhanced channel image, the background texture suppression channel image and the brightness balanced channel image to obtain a fused image;

[0013] S6. Input the fused image into a trained defect detection model to obtain a detection result, wherein the defect detection model is constructed using a YOLO network.

[0014] Further, the specific process of step S2 includes:

[0015] S21. Randomly select one of the R channel image, the G channel image and the B channel image of the original image as a feature image;

[0016] S22. Perform contrast-limited adaptive histogram equalization on the feature image to obtain an enhanced feature image;

[0017] S23. Perform brightness and contrast adjustment on the enhanced feature map to obtain an enhanced channel map.

[0018] Further, the step S23 performs contrast adjustment on the enhanced feature map, which is expressed as

[0019]

[0020] wherein I' s represents the enhanced channel map, represents the enhanced feature map, α represents a contrast factor, β represents a contrast offset, and μ represents the average brightness of the enhanced feature map.

[0021] Further, the step S3 performs Gaussian smoothing on any channel image, which is expressed as

[0022]

[0023] wherein I smooth (x,y) represents the value of the pixel point (x,y) in the channel image after Gaussian smoothing, σ represents a standard deviation, k represents the radius of the Gaussian kernel; I(x+i,y+j) represents the pixel value at the pixel point (x,y) in the channel image, and i and j are independent variables.

[0024] Further, the step S5 performs weighted fusion of the enhanced channel map, the background texture suppression channel map, and the brightness balance channel map to obtain a fused image, which is expressed as

[0025] I final = ω j ·E j + ω k ·P k + ω l ·P l

[0026] wherein I final represents the fused image, E j represents the enhanced channel map, P k represents the background texture suppression channel map, P l represents the brightness balance channel map; ω j , ω k , and ω l are weighting coefficients, ω j = 0.5, ω k = 0.35, and ω l = 0.15.

[0027] Advantages of the present application:

[0028] The application proposes a three-channel feature reconstruction technology for processing and fusing three channels of an image respectively, wherein a random channel feature enhancement method is applied for single-channel feature enhancement for a certain channel image; through random selection and enhancement of the channels of an existing image, not only the dilemma of insufficient sample quantity is avoided, but also more new samples with diversified features are generated through virtual expansion. The enhanced samples can help the target detection model to better learn different features, thereby improving its adaptability to defect samples and significantly improving the generalization ability and robustness of the model.

[0029] The application enhances the contrast of defect features in any channel through the random channel feature enhancement technology, so that the difference between the defect region and the background is more significant, and the perception ability of the target detection model to the tiny defect features is enhanced. Meanwhile, the three-channel feature reconstruction technology effectively avoids the interference of background features on defect features by independently modeling the features of each channel (such as texture change, brightness difference and defect region enhancement), improves the consistency of the defect region in multiple channels, and significantly improves the defect detection rate and detection accuracy.

[0030] The detection surface background often has irregular texture and complex pattern, which is easy to interfere with the recognition of defects. Through the random channel feature enhancement technology, only a single channel selected randomly is subjected to feature enhancement, which avoids over-enlargement of the background texture. In addition, the three-channel feature reconstruction technology separates the background and defect features, applies a suppression weight to the background features in different channels, thereby reducing the interference of background noise on defect recognition and significantly improving the accuracy of detection. BRIEF DESCRIPTION OF DRAWINGS

[0031] Figure 1 The method flowchart of the application is shown in the figure;

[0032] Figure 2 The comparative graph of the embodiment results of the application is shown in the figure. DETAILED DESCRIPTION

[0033] The technical solutions in the embodiments of the application will be described clearly and completely below with reference to the drawings in the embodiments of the application. Obviously, the described embodiments are only a part of the embodiments of the application, rather than all the embodiments of the application. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative labor fall within the protection scope of the application.

[0034] The application proposes a surface defect detection method based on channel enhancement and feature reconstruction, wherein a three-channel feature reconstruction technology is designed, the features of three channels (R, G and B channels) of an image are randomly enhanced and reconstructed, which helps the model to realize effective virtual data expansion, improve the prominence of defect features and reduce background interference in the case of data scarcity, such asFigure 1 as shown, comprising the following steps:

[0035] S1. Obtain an original image.

[0036] S2. Process any channel image of the original image through a random channel feature enhancement method to obtain an enhanced channel graph.

[0037] Specifically, the present application particularly proposes a random channel feature enhancement method in a three-channel feature reconstruction technology. The random channel feature enhancement method can enhance the defect feature in a single channel image of the image, i.e., amplify the difference between the defect region and the background, so that the model can more easily perceive the tiny defect feature. Using the random channel enhancement method to improve the not obvious defect feature can make the target detection (YOLO) model more easily learn the not obvious feature and thus improve the detection rate of the model.

[0038] The specific process of step S2 includes:

[0039] S21. Randomly select one of the R channel image, the G channel image and the B channel image of the original image as a feature image.

[0040] S22. Perform contrast limited adaptive histogram equalization (CLAHE) on the feature image to obtain an enhanced feature image.

[0041] Specifically, step S22 includes:

[0042] S221. Divide the feature image into 16x16 small blocks, and calculate the gray value histogram of each small block, wherein

[0043]

[0044] H k (g) represents the number of pixel points with a pixel value of g in the kth small block, N k represents the total number of pixel points in the kth small block, I k (i) represents the pixel value of the i-th pixel point in the kth small block; δ() represents an indicator function, which is 1 when I k (i) = g, and 0 otherwise. k (i) = g.

[0045] S222. In order to avoid over-enhancement of the feature image and introduce noise, a limited contrast calculation is added in the calculation process. Under normal circumstances, the local histogram of each small block is clipped, i.e., the peak value of the histogram is limited to prevent some gray levels from being over-enhanced. If the cumulative frequency of a certain gray level g is greater than the set limit value T (usually set as a threshold), it is clipped by 1, so that the cumulative frequency of each gray level does not exceed the limit.

[0046] S223. Calculate the cumulative distribution function (CDF) of the small patches according to the clipped gray value histogram, denoted as

[0047]

[0048] H′ k (j) = min(H k (j), T)

[0049] where CDF k (g) represents the cumulative distribution function of the kth small patch; H′ k (j) represents the number of pixel points with a pixel value of g in the kth small patch after clipping;

[0050] S224. Normalize the cumulative distribution function to the range of 0 to L-1 to obtain the equalized output, denoted as

[0051]

[0052] where CDF k (0) is the minimum cumulative distribution value of the kth small patch, CDF k (L-1) is the maximum cumulative distribution value of the kth small patch, CDF′ k (g) is the equalized result, and L represents the gray level of the feature image.

[0053] S225. Merge the small patches into a complete image according to the equalized output, and perform smooth transition according to the edges of the small patches to avoid obvious splicing marks, to obtain an enhanced feature map.

[0054] S23. Adjust the brightness and contrast of the enhanced feature map to obtain an enhanced channel map.

[0055] Specifically, the step S23 of adjusting the contrast of the enhanced feature map is denoted as

[0056]

[0057] where I' represents the enhanced channel map, represents the enhanced feature map, a represents a contrast factor, β represents a contrast offset, and μ represents the average brightness of the enhanced feature map.

[0058] S3. Perform Gaussian smoothing on any one of the two channel images of the original image not selected in step S2 to obtain a background texture suppression channel image.

[0059] Specifically, in the traditional target detection task, there is a certain degree of redundancy in the features of each channel, especially in the three-channel enhancement process, the mixing of background information and defect information may lead to a decrease in detection accuracy. The three-channel feature reconstruction technology of the present application reconstructs the defect features in different channels into independent feature representations (such as channel 1 captures texture changes, channel 2 focuses on brightness differences, and channel 3 enhances defect features), in this way, to reduce the problem of background information covering defect features reducing the detection rate of the target detection model caused by the random channel feature enhancement technology. Through three-channel feature reconstruction, the consistency of the not obvious defect features in the multi-channel dimension is strengthened, so that the not obvious defect area is effectively modeled, and the detection rate of the target detection (YOLO) model is improved. The enhancement goal of these channels is to maintain specific features while avoiding excessive background interference. Therefore, different channels perform different mathematical calculation processes.

[0060] Step S3 performs Gaussian smoothing on any channel image to suppress background texture information, denoted as

[0061]

[0062] where I smooth (x,y) represents the value of the pixel point (x,y) in the channel image after Gaussian smoothing, σ represents the standard deviation, k represents the radius of the Gaussian kernel; I(x+i,y+j) represents the pixel value at the pixel point (x,y) in the channel image, and i,j are independent variables.

[0063] S4. Perform balanced brightness processing on the last channel image P that has not been processed to avoid the influence of brightness differences between the background and the defect on feature extraction, and obtain a brightness balanced channel image P l , which can be represented as

[0064] P l =α′·P+β′

[0065] where α' represents a brightness factor, and β' represents a brightness offset. Through this method, the channel C l will enhance the brightness information, thereby improving the contrast between the defect area and the background and reducing the background interference.

[0066] S5. Weighted fusion of the enhanced channel image, the background texture suppression channel image and the brightness balanced channel image to obtain a fused image.

[0067] Specifically, step S5 performs weighted fusion of the enhanced channel image, the background texture suppression channel image and the brightness balanced channel image to obtain a fused image, denoted as

[0068] I final =ω j ·E j +ωk ·P k +ω l ·P l

[0069] wherein I final represents a fusion image, E j represents an enhancement channel image, P k represents a background texture suppression channel image, P l represents a brightness balance channel image; ω j , ω k , ω l are weighting coefficients, ω j = 0.5, ω k = 0.35, ω l = 0.15. The fusion image I final is the result image after feature enhancement, background suppression and brightness balance processing, as shown in FIG. 8, this image has more significant contrast on the defect area, while the noise or texture influence on the background area is weakened. Therefore, the deep learning model (YOLO) can more easily learn and identify defects. Figure 2

[0070] S6. The fusion image is input into a trained defect detection model to obtain a detection result, wherein the defect detection model is constructed by using a YOLO network.

[0071] In the training process and the inference process, the three-channel feature reconstruction is performed on the preprocessed image to obtain a fusion image before image processing and model inference.

[0072] In the present application, unless otherwise explicitly specified and limited, the terms "mounting", "setting", "connecting", "fixing", "rotating" and the like should be understood in a broad sense, for example, can be fixedly connected, or can be detachably connected, or can be integrated; can be mechanically connected, or can be electrically connected; can be directly connected, or can be indirectly connected through an intermediate medium; can be the internal communication of two elements or the interaction relationship between two elements, unless otherwise explicitly limited, the above-mentioned terms in the present application can be understood according to the specific meaning of the above-mentioned terms in the present application according to the specific circumstances.

[0073] Although the embodiments of the present application have been shown and described, it can be understood by those skilled in the art that various changes, modifications, replacements and variations can be made to the embodiments without departing from the principles and spirits of the present application, the scope of the present application is defined by the appended claims and their equivalents.​

Claims

1. A surface defect detection method based on channel enhancement and feature reconstruction, characterized in that, Includes the following steps: S1. Obtain the original image; S2. The original image is processed by random channel feature enhancement method to obtain enhanced channel image; S3. Perform Gaussian smoothing on any one of the two channel images of the original image that were not selected in step S2 to obtain the background texture suppression channel image; S4. Perform brightness balancing processing on the last unprocessed channel image to obtain a brightness balancing channel image; S5. Weighted fusion of the enhancement channel map, background texture suppression channel map, and brightness balance channel map is performed to obtain the fused image; S6. Input the fused image into the trained defect detection model to obtain the detection result. The defect detection model is constructed using a YOLO network.

2. The surface defect detection method based on channel enhancement and feature reconstruction according to claim 1, characterized in that, The specific process of step S2 includes: S21. Randomly select one image from the three channels of the original image: the R channel image, the G channel image, and the B channel image, as the feature image; S22. Perform contrast-limited adaptive histogram equalization on the feature image to obtain an enhanced feature map; S23. Adjust the brightness and contrast of the enhanced feature map to obtain the enhanced channel map.

3. The surface defect detection method based on channel enhancement and feature reconstruction according to claim 2, characterized in that, Step S23 involves adjusting the contrast of the enhanced feature map, as shown below. Among them, I′ s This indicates an enhanced channel plot. Let α represent the enhanced feature map, β represent the contrast factor, β represent the contrast offset, and μ represent the average brightness of the enhanced feature map.

4. The surface defect detection method based on channel enhancement and feature reconstruction according to claim 1, characterized in that, Step S3 performs Gaussian smoothing on any channel image, represented as... Among them, I smooth (x,y) represents the Gaussian smoothed value of pixel (x,y) in the channel image, σ represents the standard deviation, and k represents the radius of the Gaussian kernel; I(x+i,y+j) represents the pixel value at pixel (x,y) in the channel image, where i and j are independent variables.

5. The surface defect detection method based on channel enhancement and feature reconstruction according to claim 1, characterized in that, Step S4 performs brightness balancing processing on any channel to obtain the brightness balancing channel image P. l ,include: P l =α′·P+β′ Where α' represents the luminance factor and β' represents the luminance offset.

6. The surface defect detection method based on channel enhancement and feature reconstruction according to claim 1, characterized in that, Step S5 involves weighted fusion of the enhancement channel map, background texture suppression channel map, and brightness balance channel map to obtain a fused image, denoted as I. final =ω j ·E j +ω k ·P k +ω l ·P l Among them, I final E represents the fused image. j Indicates an enhanced channel plot, P k P represents the background texture suppression channel map. l Represents the brightness balance channel diagram; ω j ω k ω l ω is the weighting coefficient. j =0.5, ω k =0.35, ω l =0.15.

Citation Information

Patent Citations

  • Background modeling method based on brightness and texture fusion threshold value

    CN106570885A

  • Low-light-level image rapid enhancement method and apparatus based on retinex

    WO2020107308A1