Ceramic surface defect detection method
By constructing an annotated data set and training a ceramic surface defect detection model, combining data augmentation and noise reduction processing, the problems of low efficiency and low accuracy of ceramic surface defect detection are solved, and efficient identification of complex textures and small-size defects are achieved.
Patent Information
- Application Number
- CN202510358536.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-25
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2045-03-25
AI Technical Summary
In the prior art, ceramic surface defect detection problems are low detection efficiency and low accuracy, especially in complex textures and small-size defects such as tiny cracks, pinholes, etc., which are difficult to identify.
A data set marked with ceramic surface defects is constructed, the data set is expanded through data augmentation method, the ceramic surface defect detection model is trained, and the overall and local noise reduction treatment is combined, and the convolutional neural network is used for feature extraction and edge detection to generate ceramic surface defect detection results.
Accurate identification and detection of ceramic surface defects is achieved, and detection efficiency and accuracy are improved.
Smart Images

Figure CN120298341A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of defect detection, and particularly to a method for detecting ceramic surface defects. Background Art
[0002] As a widely used material, the surface quality of ceramics has an important impact on the appearance, performance and market value of products. The detection of ceramic surface defects is a key link to ensure product quality. In recent years, with the continuous progress of industrial technology, the technology for detecting ceramic surface defects has also developed rapidly. In the prior art, for the ceramic surface with complex textures, such as antique bricks, art bricks, etc., the texture information is likely to cover up the defect features, resulting in difficult detection. Small-sized defects on the ceramic surface, such as microcracks, pinholes, etc., are difficult to be identified by traditional detection methods due to their small size and unobvious features. It is very difficult to detect the flatness defects on the ceramic surface. There are problems of low detection efficiency and low accuracy in the detection of ceramic surface defects. Summary of the Invention
[0003] The present invention aims to solve at least one of the technical problems in the above technologies to some extent. For this purpose, the object of the present invention is to provide a method for detecting ceramic surface defects, which improves the detection efficiency and accuracy of ceramic surface defects.
[0004] To achieve the above object, an embodiment of the present invention provides a method for detecting ceramic surface defects, including:
[0005] Constructing a data set labeled with ceramic surface defects;
[0006] Constructing a ceramic surface defect detection model;
[0007] Iteratively training the ceramic surface defect detection model based on the data set labeled with ceramic surface defects to obtain a target detection model;
[0008] Obtaining a ceramic surface image and inputting it into the target detection model to output the detection result of ceramic surface defects.
[0009] According to some embodiments of the present invention, constructing a data set labeled with ceramic surface defects includes:
[0010] Obtaining an initial data set;
[0011] Adjusting the size of the ceramic images in the initial data set and expanding the initial data set based on the data augmentation method to obtain an augmented data set;
[0012] Using the Labelimg tool to perform defect annotation on the augmented data set to obtain a data set labeled with ceramic surface defects.
[0013] According to some embodiments of the present invention, the data augmentation method includes at least one of horizontal flipping, vertical flipping, and scale transformation processing.
[0014] According to some embodiments of the present invention, obtaining a ceramic surface image and inputting it into a target detection model to output a ceramic surface defect detection result, including:
[0015] The target detection model performs noise reduction processing on the ceramic surface image to obtain an optimized image;
[0016] Crop the optimized image to obtain a cropped image with a pixel size of m*n;
[0017] Extract the gray value information of the pixel points in each row and each column of the cropped image respectively to obtain m + n pieces of gray value data;
[0018] Calculate the overall average variance and overall average value of the m + n pieces of gray value data;
[0019] Calculate the local variance and local mean of each piece of gray value data, and compare them with the overall average variance and overall average value respectively. When it is determined that at least one piece of gray value data has an absolute value of the difference between the local variance and the overall average variance greater than a first preset threshold and an absolute value of the difference between the local mean and the overall average value greater than a second preset threshold, generate a detection result of unevenness on the ceramic surface.
[0020] According to some embodiments of the present invention, the target detection model performs noise reduction processing on the ceramic surface image to obtain an optimized image, including:
[0021] Perform overall noise reduction processing on the ceramic surface image based on the target detection model to obtain an initial noise-reduced image;
[0022] Perform local noise reduction processing on the initial noise-reduced image based on the target detection model to obtain an optimized image.
[0023] According to some embodiments of the present invention, performing overall noise reduction processing on the ceramic surface image based on the target detection model to obtain an initial noise-reduced image, including:
[0024] Calculate the signal-to-noise ratio of the ceramic surface image;
[0025] Perform edge detection processing on the ceramic surface image based on the canny edge detection algorithm to determine the edge region of the ceramic surface image and obtain the gradient value of the edge region;
[0026] Perform normalization processing on the signal-to-noise ratio and the gradient value to determine the corresponding weight coefficients;
[0027] Based on the signal-to-noise ratio, gradient value, and corresponding weight coefficients, the noise reduction features of the ceramic surface image are calculated; based on the noise reduction features, the preset noise reduction feature-noise reduction coefficient data table is queried to obtain the first noise reduction coefficient, and the overall noise reduction process is performed on the ceramic surface image to obtain the initial noise reduction image.
[0028] According to some embodiments of the present invention, local noise reduction processing is performed on the initial noise reduction image based on the target detection model to obtain an optimized image, including:
[0029] Determine all noise pixel points in the initial noise reduction image;
[0030] Taking any noise pixel point as the central pixel point, determine the N*N area with the central pixel point as the area center as the first area; determine the M*M area with the central pixel point as the area center, and remove the first area from the M*M area to obtain the second area; where the M*M area is larger than the N*N area;
[0031] Determine the second noise reduction coefficient of the first area according to the pixel points in the first area and the pixel points in the second area;
[0032] Perform local noise reduction processing on the noise pixel points according to the second noise reduction coefficient to obtain an optimized image.
[0033] According to some embodiments of the present invention, determining the second noise reduction coefficient of the first area according to the pixel points in the first area and the pixel points in the second area includes:
[0034] Calculate the first color feature in the first area and the second color feature in the second area, and determine the color difference value according to the first color feature and the second color feature; query the first noise reduction data table according to the color difference value to determine the color noise reduction coefficient of the first area;
[0035] Calculate the first pixel feature in the first area and the second pixel feature in the second area, and determine the pixel difference value of the first area according to the first pixel feature and the second pixel feature; query the second data table according to the pixel difference value to determine the pixel noise reduction coefficient of the second area;
[0036] Calculate the average value of the color noise reduction coefficient and the pixel noise reduction coefficient as the second noise reduction coefficient of the first area.
[0037] According to some embodiments of the present invention, obtaining the ceramic surface image and inputting it into the target detection model to output the ceramic surface defect detection result includes:
[0038] Based on the convolutional neural network of the target detection model, feature extraction is performed on the ceramic surface image to obtain a feature map;
[0039] Process the feature map based on the adaptive thresholding algorithm to obtain a binary map;
[0040] Determine the size of the recognition sliding window according to the size of the ceramic surface image, and generate a number of candidate boxes based on the sliding window;
[0041] Map each candidate box to the corresponding position area of the binary image, and determine the maximum value, minimum value and average value of the pixel points in the position area;
[0042] Determine the scale space corresponding to the candidate box according to the maximum value, minimum value and average value of the pixel points in the position area;
[0043] Extract the characteristic pixel points in the candidate box along the scale axis of the scale space, perform Softmax classification through the cross-entropy loss function, and generate multiple sets of characteristic pixel points;
[0044] Obtain the weight information of each set of characteristic pixel points, and perform image parsing on the candidate box according to the weight information to obtain the parsing result of the candidate box;
[0045] Determine the ceramic surface defect detection result based on the parsing results of a number of candidate boxes.
[0046] The present invention proposes a method for detecting ceramic surface defects. By constructing a data set labeled with ceramic surface defects, constructing a ceramic surface defect detection model, iteratively training the model based on the data set, and obtaining a ceramic surface image and inputting it into the model for detection, etc., accurate recognition and detection of ceramic surface defects are realized.
[0047] Other features and advantages of the present invention will be described in the following specification, and, in part, will be obvious from the specification, or will be understood by implementing the present invention. The objectives and other advantages of the present invention can be achieved and obtained by the structure specifically pointed out in the written specification and the drawings.
[0048] The following will further describe the technical solutions of the present invention in detail through the drawings and embodiments. Description of the Drawings
[0049] The drawings are used to provide a further understanding of the present invention, and constitute a part of the specification. They are used together with the embodiments of the present invention to explain the present invention, and do not constitute a limitation to the present invention. In the drawings:
[0050] Figure 1 is a flowchart of a method for detecting ceramic surface defects according to an embodiment of the present invention;
[0051] Figure 2 is a flowchart of constructing a data set labeled with ceramic surface defects according to an embodiment of the present invention;
[0052] Figure 3It is a flowchart for outputting the detection results of ceramic surface defects according to an embodiment of the present invention. Detailed implementation manners
[0053] The preferred embodiments of the present invention will be described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are only for the purpose of illustrating and explaining the present invention, and are not used to limit the present invention.
[0054] As Figure 1 shown, an embodiment of the present invention proposes a method for detecting ceramic surface defects, including steps S1 - S4:
[0055] S1. Construct a dataset labeled with ceramic surface defects;
[0056] S2. Construct a ceramic surface defect detection model;
[0057] S3. Iteratively train the ceramic surface defect detection model based on the dataset labeled with ceramic surface defects to obtain a target detection model;
[0058] S4. Obtain a ceramic surface image and input it into the target detection model to output the detection results of ceramic surface defects.
[0059] The working principle of the above technical solution: Collect a large number of ceramic surface images from the ceramic production line. These images should contain various defect types, such as cracks, pinholes, color differences, deformations, etc. Use professional annotation tools or software to manually annotate the defects in the images. The annotation content can include information such as the type, location, and size of the defects. The ceramic surface defect detection model is the YOLOv8n model. Initialize it with pre-trained model parameters to accelerate the training speed and improve the model performance. Use the labeled dataset to iteratively train the model. In each iteration, input a batch of images into the model, calculate the loss function, and update the model parameters according to the gradient of the loss function. Optimization algorithms, such as Stochastic Gradient Descent (SGD), Adam, etc., can be used during the training process to accelerate convergence and improve performance. When the performance of the model on the validation set reaches a satisfactory level, stop the training and obtain the final target detection model. Input the ceramic surface image to be detected into the target detection model. The model will analyze and process the image to identify the defects therein.
[0060] The beneficial effects of the above technical solution: By constructing a dataset labeled with ceramic surface defects, constructing a ceramic surface defect detection model, iteratively training the model based on the dataset, and obtaining a ceramic surface image and inputting it into the model for detection, etc., the accurate identification and detection of ceramic surface defects are realized.
[0061] As Figure 2As shown, according to some embodiments of the present invention, a dataset labeled with ceramic surface defects is constructed, including steps S11 - S13:
[0062] S11. Obtain an initial dataset;
[0063] S12. Adjust the sizes of the ceramic images in the initial dataset, and augment the initial dataset based on data augmentation methods to obtain an augmented dataset;
[0064] S13. Use the Labelimg tool to perform defect annotation on the augmented dataset to obtain a dataset labeled with ceramic surface defects.
[0065] The working principle of the above technical solution: Adjust the sizes of the ceramic images in the initial dataset to ensure that all images have a unified size. Apply data augmentation methods to augment the initial dataset to improve the generalization ability and robustness of the model. Through data augmentation, more ceramic surface images with different variations can be generated, thereby increasing the diversity and richness of the dataset. Merge the images after applying the data augmentation methods with the images in the initial dataset to form an augmented dataset. Use the Labelimg tool to perform defect annotation on the ceramic images in the augmented dataset. Assign a type label to each annotated defect for subsequent model training and validation.
[0066] The beneficial effects of the above technical solution: Obtain a dataset labeled with ceramic surface defects. This dataset will serve as the basis for model training, helping the model learn the characteristics and patterns of ceramic surface defects, so as to achieve accurate identification and detection of ceramic surface defects.
[0067] According to some embodiments of the present invention, the data augmentation method includes at least one of horizontal flipping, vertical flipping, and scale transformation processing.
[0068] As Figure 3 shown, according to some embodiments of the present invention, obtain a ceramic surface image and input it into a target detection model, and output a ceramic surface defect detection result, including steps S41 - S45:
[0069] S41. The target detection model performs noise reduction processing on the ceramic surface image to obtain an optimized image;
[0070] S42. Crop the optimized image to obtain a cropped image with a pixel size of m * n;
[0071] S43. Respectively extract the gray value information of the pixel points in each row and each column of the cropped image to obtain m + n pieces of gray value data;
[0072] S44. Calculate the overall average variance and overall average value of the m + n pieces of gray value data;
[0073] S45. Calculate the local variance and local mean of each grayscale value data, and compare them with the overall average variance and overall average value respectively. When it is determined that at least one grayscale value data has an absolute value of the difference between the local variance and the overall average variance greater than a first preset threshold and an absolute value of the difference between the local mean and the overall average value greater than a second preset threshold, generate a detection result that the ceramic surface is uneven.
[0074] The working principle of the above technical solution: The object detection model performs noise reduction processing on the ceramic surface image to obtain an optimized image; removes or weakens the noise in the image to improve the image quality. The cropping operation is to extract the region of interest (ROI) from the optimized image, that is, a specific part of the ceramic surface. By cropping, the computational amount of subsequent processing can be reduced and the processing efficiency can be improved. The grayscale value is the brightness information of the pixel points in the image, reflecting the light and dark degree of the objects in the image. By extracting the grayscale value information, the texture, color and other characteristics of the ceramic surface can be analyzed. Traverse each row and each column of the cropped image to extract the grayscale value of each pixel point. The grayscale values of each row form a piece of data, and the grayscale values of each column also form a piece of data, resulting in a total of m + n pieces of grayscale value data. The overall average variance and overall average value are statistical quantities that describe the overall distribution characteristics of the grayscale value data. By calculating these statistical quantities, the overall characteristics of the grayscale value data can be understood and analyzed. Calculate the average value and variance for each of the m + n pieces of grayscale value data respectively. The average value reflects the central position of the grayscale value data, and the variance reflects the degree of dispersion of the grayscale value data. The local variance and local mean are statistical quantities that describe the local distribution characteristics of the grayscale value data. By calculating these local statistical quantities, the local characteristics of the grayscale value data can be understood and analyzed. Compare the local variance and local mean of each piece of grayscale value data with the overall average variance and overall average value respectively. If at least one piece of grayscale value data has an absolute value of the difference between the local variance and the overall average variance greater than a first preset threshold, and an absolute value of the difference between the local mean and the overall average value greater than a second preset threshold, it is considered that there is an uneven defect on the ceramic surface. When the above conditions are met, a detection result that the ceramic surface is uneven is generated.
[0075] The beneficial effects of the above technical solution: Perform noise reduction, cropping, grayscale value extraction, statistical quantity calculation and comparison judgment on the ceramic surface image, and finally generate a detection result that the ceramic surface is uneven.
[0076] According to some embodiments of the present invention, the object detection model performs noise reduction processing on the ceramic surface image to obtain an optimized image, including:
[0077] Perform overall noise reduction processing on the ceramic surface image based on the object detection model to obtain an initial noise-reduced image;
[0078] Perform local noise reduction processing on the initial noise-reduced image based on the object detection model to obtain an optimized image.
[0079] The working principle of the above technical solution: Perform global noise reduction processing on the ceramic surface image to remove most of the noise in the image. The overall noise reduction processing can smooth the image, reduce the influence of high-frequency noise, and provide a more stable image basis for subsequent processing. On the basis of overall noise reduction, further noise reduction processing is performed on local regions in the image. The local noise reduction processing can perform refined processing on specific regions in the image, retaining more image details and edge information. The optimized image has higher clarity and accuracy, which can improve the accuracy and efficiency of defect detection.
[0080] The beneficial effects of the above technical solution: The noise reduction processing flow of the ceramic surface image based on the object detection model includes two steps: overall noise reduction processing and local noise reduction processing. Through the processing of these two steps, a clearer and more accurate optimized image is obtained.
[0081] According to some embodiments of the present invention, performing overall noise reduction processing on the ceramic surface image based on the object detection model to obtain an initial noise-reduced image includes:
[0082] Calculate the signal-to-noise ratio of the ceramic surface image;
[0083] Perform edge detection processing on the ceramic surface image based on the canny edge detection algorithm, determine the edge region of the ceramic surface image, and obtain the gradient value of the edge region;
[0084] Perform normalization processing on the signal-to-noise ratio and the gradient value to determine the corresponding weight coefficient;
[0085] Based on the signal-to-noise ratio, the gradient value, and the corresponding weight coefficient, calculate the noise reduction feature of the ceramic surface image; query the preset noise reduction feature-noise reduction coefficient data table based on the noise reduction feature to obtain the first noise reduction coefficient, and perform overall noise reduction processing on the ceramic surface image to obtain an initial noise-reduced image.
[0086] Working principle of the above technical solution: The ceramic surface image is segmented into multiple small blocks to facilitate the calculation of the signal-to-noise ratio (SNR) of each small block. For each small block, the average value of its pixel values is calculated as the signal intensity. The standard deviation of the pixel values of each small block is calculated as the noise intensity. The SNR of each small block is calculated using the formula SNR = signal intensity / noise intensity. The ceramic surface image is converted into a grayscale image to facilitate edge detection. The edges are highlighted by suppressing non-edge pixel points. Two thresholds are used to determine the edge pixel points and connect them into a complete edge. According to the edge detection results, the edge regions of the ceramic surface image are determined, and the gradient values of these regions are obtained. The SNR and gradient values are mapped to a unified normalized range, and based on the normalized SNR and gradient values, their corresponding weight coefficients are determined. These weight coefficients can reflect the importance of the SNR and gradient values in the noise reduction process. The normalized SNR and gradient values are multiplied by their corresponding weight coefficients to obtain the noise reduction features. The noise reduction features of each small block are integrated to form the noise reduction features of the entire ceramic surface image. A noise reduction feature-noise reduction coefficient data table is pre-constructed, which associates the noise reduction features with the corresponding noise reduction coefficients. According to the calculated noise reduction features, the first noise reduction coefficient is obtained by querying the data table.
[0087] Beneficial effects of the above technical solution: The ceramic surface image is effectively subjected to overall noise reduction processing to obtain an initial noise reduction image with higher clarity and accuracy.
[0088] According to some embodiments of the present invention, based on the object detection model, the initial noise reduction image is locally noise-reduced to obtain an optimized image, including:
[0089] Determine all the noise pixel points in the initial noise reduction image;
[0090] Taking any noise pixel point as the central pixel point, determine an N*N area with the central pixel point as the area center as the first area; determine an M*M area with the central pixel point as the area center, and remove the first area from the M*M area to obtain the second area; where the M*M area is larger than the N*N area;
[0091] Determine the second noise reduction coefficient of the first area according to the pixel points in the first area and the pixel points in the second area;
[0092] Perform local noise reduction processing on the noise pixel points according to the second noise reduction coefficient to obtain an optimized image.
[0093] Working principle of the above technical solution: Using the noise detection algorithm in the object detection model, scan the initial noise-reduced image to identify all possible noise pixel points. Select any one of the confirmed noise pixel points as the central pixel point. With the central pixel point as the center, determine an N*N rectangular area as the first area. This area will be used to calculate the second noise reduction coefficient. With the central pixel point as the center, determine a larger MM rectangular area. Then, remove the first area from this MM area, and the remaining part is the second area. The second area will be used to assist in calculating the second noise reduction coefficient of the first area. Determine the second noise reduction coefficient of the first area according to the pixel points in the first area and the pixel points in the second area; perform local noise reduction processing on the noise pixel points according to the second noise reduction coefficient to obtain an optimized image.
[0094] Beneficial effects of the above technical solution: Effectively perform local noise reduction processing on the initial noise-reduced image to obtain an optimized image with higher clarity and accuracy.
[0095] According to some embodiments of the present invention, determining the second noise reduction coefficient of the first area according to the pixel points in the first area and the pixel points in the second area includes:
[0096] Calculate the first color feature in the first area and the second color feature in the second area, and determine the color difference value according to the first color feature and the second color feature; query the first noise reduction data table according to the color difference value to determine the color noise reduction coefficient of the first area;
[0097] Calculate the first pixel feature in the first area and the second pixel feature in the second area, and determine the pixel difference value according to the first pixel feature and the second pixel feature; query the second data table according to the pixel difference value to determine the pixel noise reduction coefficient of the second area;
[0098] Calculate the mean value of the color noise reduction coefficient and the pixel noise reduction coefficient as the second noise reduction coefficient of the first area.
[0099] Working principle of the above technical solution: For all pixel points in the first region, calculate their color components in the selected color space, and calculate the first color feature in the first region. Similarly, calculate the second color feature in the second region. According to the first color feature and the second color feature, calculate the difference value between them. A first noise reduction data table is pre-constructed, which associates the color difference value with the corresponding color noise reduction coefficient. According to the calculated color difference value, query the first noise reduction data table to obtain the color noise reduction coefficient of the first region. Calculate the first pixel feature in the first region and the second pixel feature in the second region, and determine the pixel difference value of the first region according to the first pixel feature and the second pixel feature; A second noise reduction data table is pre-constructed, which associates the pixel difference value with the corresponding pixel noise reduction coefficient. According to the calculated pixel difference value, query the second noise reduction data table to obtain the pixel noise reduction coefficient of the second region. Calculate the average value of the color noise reduction coefficient and the pixel noise reduction coefficient to obtain the second noise reduction coefficient of the first region. This coefficient will comprehensively consider the influence of color features and pixel features on noise reduction processing. Apply the calculated second noise reduction coefficient to the noise pixel points in the first region for local noise reduction processing.
[0100] Beneficial effects of the above technical solution: More accurately determine the second noise reduction coefficient of the first region, thereby improving the effect of local noise reduction processing.
[0101] According to some embodiments of the present invention, calculating the first color feature in the first region includes:
[0102] Obtain the RGB color values of all pixel points in the first region, where the RGB color values include the R-channel value, the G-channel value, and the B-channel value;
[0103] According to the RGB color values of all pixel points, calculate the average value of all pixel points in the first region in the R channel, the average value of the G channel, and the average value of the B channel, and calculate the color feature of the first region:
[0104]
[0105] Wherein, T is the color feature of the first region; N is the number of pixel points included in the first region; Is the average value of all pixel points included in the first region in the R channel; Is the average value of the pixel points included in the first region in the G color channel; Is the average value of the pixel points included in the first region in the B color channel; R i Is the R-channel value of the i-th pixel point included in the first region; G i Is the G-channel value of the i-th pixel point included in the first region; B i Is the value of the B channel of the i-th pixel point included in the first region.
[0106] Working principle of the above technical solution: According to the preset size of N*N, determine the position and range of the first area in the initial noise-reduced image. For each pixel point in the first area, read its R-channel value, G-channel value, and B-channel value in the RGB color space. Calculate the average value of all pixel points in the first area in the R channel, the average value in the G channel, and the average value in the B channel, and calculate the color feature of the first area. The T value reflects the uniformity and concentration of the color in the first area. When the T value is large, it indicates that the color in the first area is relatively uniform and changes little; when the T value is small, it indicates that the color in the first area changes greatly and may contain noise or edges. In local noise reduction processing, we can judge whether the first area needs stronger noise reduction processing according to the size of the T value. If the T value is small, it may mean that there is noise or an edge in this area and more refined processing is required.
[0107] Beneficial effects of the above technical solution: The color feature T of the first area can be accurately calculated, providing strong support for subsequent local noise reduction processing.
[0108] According to some embodiments of the present invention, calculating the first pixel feature in the first area includes:
[0109] Obtain the pixel gradient in the vertical direction and the pixel gradient in the horizontal direction of the first area, and calculate the pixel feature of the first area:
[0110]
[0111] where S is the pixel feature of the first area; D1 is the pixel gradient in the vertical direction of the first area; D2 is the pixel gradient in the horizontal direction of the first area; M θ is the number of pixel points with an angle of θ in the first area; T 1(x) is the pixel gradient at x in the vertical direction of the first area; T 2(x) is the pixel gradient at x in the horizontal direction of the first area; ||||0 is the L0 norm, which is used to count the number of non-zero vectors.
[0112] Working principle of the above technical solution: For each pixel point in the first region, calculate its gradient in the vertical direction (y direction). This can be achieved by comparing the gray value differences between this pixel point and its adjacent pixel points above and below. Average or sum the vertical gradients of all pixel points to obtain the vertical gradient. Calculate the gradient of each pixel point in the first region in the horizontal direction (x direction). Average or sum the horizontal gradients of all pixel points to obtain the horizontal gradient. For each pixel point in the first region, calculate the gradient direction angle θ of this pixel point based on its vertical gradient and horizontal gradient. This can be achieved through the arctangent function arctan(D1 / D2). Initialize an angle statistics array or hash table to record the number of pixel points at different angles θ. Traverse all pixel points in the first region, and update the count of the corresponding angle in the angle statistics array or hash table according to the calculated angle θ. Calculate the L0 norm of the number of pixel points at all angles θ, that is, count the number of pixel points at different angles. Multiply the logarithm of the gradient magnitude by the weighted value of the angle statistics to obtain the pixel feature of the first region. The S value synthesizes the gradient magnitude and gradient direction information of the first region, reflecting the texture complexity and directionality of this region. When the S value is large, it indicates that the texture of the first region is relatively complex, and may contain more details or edges; when the S value is small, it indicates that the texture of the first region is relatively simple, and may be smoother or more uniform. In local noise reduction processing, it can be judged whether the first region needs stronger edge preservation or detail enhancement processing according to the size of the S value. If the S value is large, it may mean that this region contains important texture information and requires more refined processing.
[0113] Beneficial effects of the above technical solution: It is convenient to accurately determine the pixel features of the first region and improve the accuracy of determining the pixel noise reduction coefficient.
[0114] The method for calculating the second color feature and the second pixel feature of the second region is the same as that for calculating the first color feature and the first pixel feature in the first region.
[0115] According to some embodiments of the present invention, obtain the ceramic surface image and input it into the target detection model, and output the ceramic surface defect detection result, including:
[0116] Perform feature extraction on the ceramic surface image based on the convolutional neural network of the target detection model to obtain a feature map;
[0117] Process the feature map based on the adaptive thresholding algorithm to obtain a binary map;
[0118] Determine the size of the recognition sliding window according to the size of the ceramic surface image, and generate a number of candidate boxes based on the sliding window;
[0119] Map each candidate box to the corresponding position area of the binary image, and determine the maximum value, minimum value, and average value of the pixel points in the position area;
[0120] Determine the scale space corresponding to the candidate box according to the maximum value, minimum value, and average value of the pixel points in the position area;
[0121] Extract the feature pixel points in the candidate box along the scale axis of the scale space, perform Softmax classification through the cross-entropy loss function, and generate multiple sets of feature pixel points;
[0122] Obtain the weight information of each set of feature pixel points, and perform image parsing on the candidate box according to the weight information to obtain the parsing result of the candidate box;
[0123] Determine the ceramic surface defect detection result based on the parsing results of several candidate boxes.
[0124] The working principle of the above technical solution: In the object detection model, multi-scale features are fused through the Feature Pyramid Network to enhance the detection ability of small defects. The Sauvola algorithm or Niblack method is used to dynamically calculate the threshold of each local area to adapt to the problem of uneven illumination. Opening and closing operations are performed on the binary image to eliminate noise points and connect broken regions.
[0125]
[0126] Among them, T(x, y) is the optimized binary image; m(x, y) is the local mean; s(x, y) is the standard deviation; k is the control parameter; R is the dynamic range.
[0127] Build a 3-5 layer pyramid, with the scaling ratio increasing by the square root of 2 for each layer, covering the defect scale distribution. Based on K-means clustering, the defect sizes are statistically analyzed, and anchor boxes with aspect ratios adapted to the length and width are designed (such as 1:2, 1:1, 2:1). The integral image is used to quickly calculate the candidate region statistics and reduce repeated operations. Low-texture regions are filtered through edge density analysis to reduce invalid candidate boxes.
[0128] Query the preset maximum-minimum-average-scale space data table according to the maximum value, minimum value, and average value of the pixel points in the position area to determine the Gaussian pyramid: perform multi-scale smoothing on the candidate region to generate a scale sequence.
[0129] Feature quantization: Calculate statistical features such as local contrast (LCP), entropy value, and edge density at each scale. Dimension reduction is performed through principal component analysis (PCA) to generate a low-dimensional feature vector.
[0130] Use Depthwise Separable convolution to construct a classification network, reducing the parameters to 1 / 9 of the conventional convolution.
[0131] Improvement of loss function:
[0132] L = λ1L CE + λ2L Dice
[0133] where L is the improved loss function; L CE is the cross - entropy loss; λ1 is the first weight; λ2 is the second weight; L Dice is the Dice loss. By combining the cross - entropy loss and the Dice loss, the problem of class imbalance is solved.
[0134] Learn the spatial attention map through the Transformer encoder: perform Softmax classification to generate multiple sets of feature pixel points; obtain the weight information of each set of feature pixel points, and perform image parsing on the candidate bounding boxes according to the weight information to obtain the parsing results of the candidate bounding boxes; determine the ceramic surface defect detection results based on the parsing results of several candidate bounding boxes.
[0135] Beneficial effects of the above technical solutions: While maintaining the detection accuracy, the computational complexity is significantly reduced, and the accuracy of determining the ceramic surface defect detection results is improved.
[0136] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalent technologies, the present invention is also intended to include these changes and modifications.
Claims
1. A method for detecting ceramic surface defects, characterized in that, Including: Construct a dataset labeled with ceramic surface defects; Construct a ceramic surface defect detection model; Iteratively train the ceramic surface defect detection model based on the dataset labeled with ceramic surface defects to obtain a target detection model; Obtain a ceramic surface image and input it into the target detection model to output the ceramic surface defect detection result.
2. The ceramic surface defect detection method according to claim 1, wherein Construct a dataset labeled with ceramic surface defects, including: Obtain an initial dataset; Adjust the size of the ceramic images in the initial dataset and expand the initial dataset based on data augmentation methods to obtain an augmented dataset; Use the Labelimg tool to perform defect annotation on the augmented dataset to obtain a dataset labeled with ceramic surface defects.
3. The ceramic surface defect detection method according to claim 2, characterized in that, The data augmentation method includes at least one of horizontal flipping, vertical flipping, and scale transformation processing.
4. The ceramic surface defect detection method according to claim 1, characterized in that, Obtain a ceramic surface image and input it into the target detection model to output the ceramic surface defect detection result, including: The target detection model performs noise reduction processing on the ceramic surface image to obtain an optimized image; Crop the optimized image to obtain a cropped image with a pixel size of m*n; Extract the gray value information of the pixel points in each row and each column of the cropped image respectively to obtain m + n pieces of gray value data; Calculate the overall average variance and overall average value of the m + n pieces of gray value data; Calculate the local variance and local mean of each piece of gray value data, and compare them with the overall average variance and overall average value respectively. When it is determined that at least one piece of gray value data has an absolute value of the difference between the local variance and the overall average variance greater than a first preset threshold and the absolute value of the difference between the local mean and the overall average value greater than a second preset threshold, generate a detection result of unevenness on the ceramic surface.
5. The ceramic surface defect detection method according to claim 4, characterized in that, The target detection model performs noise reduction processing on the ceramic surface image to obtain an optimized image, including: Perform overall noise reduction processing on the ceramic surface image based on the target detection model to obtain an initial noise-reduced image; Perform local noise reduction processing on the initial noise-reduced image based on the target detection model to obtain an optimized image.
6. The ceramic surface defect detection method according to claim 5, wherein Perform overall noise reduction processing on the ceramic surface image based on the target detection model to obtain an initial noise-reduced image, including: Calculate the signal-to-noise ratio of the ceramic surface image; Perform edge detection processing on the ceramic surface image based on the canny edge detection algorithm to determine the edge region of the ceramic surface image and obtain the gradient value of the edge region; Normalize the signal-to-noise ratio and the gradient value to determine the corresponding weight coefficients; Based on the signal-to-noise ratio, the gradient value, and the corresponding weight coefficients, calculate the noise reduction feature of the ceramic surface image; query the preset noise reduction feature-noise reduction coefficient data table based on the noise reduction feature to obtain a first noise reduction coefficient, and perform overall noise reduction processing on the ceramic surface image to obtain an initial noise-reduced image.
7. The ceramic surface defect detection method according to claim 5, characterized in that Perform local noise reduction processing on the initial noise-reduced image based on the target detection model to obtain an optimized image, including: Determine all noise pixel points in the initial noise-reduced image; Taking any noise pixel as the central pixel, determine an N*N area with the central pixel as the area center as the first area; determine an M*M area with the central pixel as the area center, and remove the first area from the M*M area to obtain the second area; where the M*M area is larger than the N*N area; Determine the second noise reduction coefficient of the first area according to the pixels in the first area and the pixels in the second area; Perform local noise reduction processing on the noise pixel according to the second noise reduction coefficient to obtain an optimized image.
8. The ceramic surface defect detection method according to claim 7, wherein, Determining the second noise reduction coefficient of the first area according to the pixels in the first area and the pixels in the second area includes: Calculate the first color feature in the first area and the second color feature in the second area, and determine the color difference value according to the first color feature and the second color feature; query the first noise reduction data table according to the color difference value to determine the color noise reduction coefficient of the first area; Calculate the first pixel feature in the first area and the second pixel feature in the second area, and determine the pixel difference value of the first area according to the first pixel feature and the second pixel feature; query the second data table according to the pixel difference value to determine the pixel noise reduction coefficient of the second area; Calculate the mean value of the color noise reduction coefficient and the pixel noise reduction coefficient as the second noise reduction coefficient of the first area.
9. The ceramic surface defect detection method according to claim 1, wherein, Obtain the ceramic surface image and input it into the target detection model, and output the ceramic surface defect detection result, including: Extract features from the ceramic surface image based on the convolutional neural network of the target detection model to obtain a feature map; Perform processing based on the adaptive thresholding algorithm according to the feature map to obtain a binary map; Determine the size of the recognition sliding window according to the size of the ceramic surface image, and generate a number of candidate boxes based on the sliding window; Map each candidate box to the corresponding position area of the binary map, and determine the maximum value, minimum value and average value of the pixel points in the position area; Determine the corresponding scale space of the candidate box according to the maximum value, minimum value and average value of the pixel points in the position area; Along the scale axis of the scale space, extract the feature pixel points in the candidate box, and perform Softmax classification through the cross-entropy loss function to generate multiple sets of feature pixel points; Obtain the weight information of each set of feature pixel points, and perform image parsing on the candidate box according to the weight information to obtain the parsing result of the candidate box; Determine the ceramic surface defect detection result based on the parsing results of several candidate boxes.
Citation Information
Patent Citations
Bathroom ceramic surface defect detection method and device based on deep learning
CN110826416A
Metal curved surface defect analysis system and method based on deep learning
CN112907519A
Bathroom ceramic surface defect detection method
CN114066817A
PCB production process online detection method based on edge detection
CN115272346A
Improved YOLOv3-based bathroom ceramic defect detection method
CN115705642A