A method for detecting defects on a ceramic surface
By constructing a labeled dataset, data augmentation, and model training, combined with overall local noise reduction processing, a convolutional neural network is used for ceramic surface defect detection. This solves the problems of low detection efficiency and low accuracy, and achieves efficient and accurate identification of ceramic surface defects.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-25
- Publication Date
- 2026-03-27
AI Technical Summary
Existing technologies for detecting defects on ceramic surfaces suffer from low detection efficiency and low accuracy, especially for complex textures and small-sized defects.
A dataset labeled with ceramic surface defects is constructed, and the dataset is expanded using data augmentation methods. A ceramic surface defect detection model is trained, and combined with global and local noise reduction processing, a convolutional neural network is used for feature extraction and candidate box analysis to generate defect detection results.
It enables accurate identification and detection of defects on ceramic surfaces, improving detection efficiency and accuracy.
Smart Images

Figure CN120298341B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of defect detection, in particular to a ceramic surface defect detection method. BACKGROUND
[0002] As a widely used material, the surface quality of ceramic has an important influence on the appearance, performance and market value of products. Ceramic surface defect detection is a key link to ensure product quality. In recent years, with the continuous progress of industrial technology, ceramic surface defect detection technology has also developed rapidly. In the prior art, for ceramic surfaces with complex textures, such as antique bricks and artistic bricks, the texture information easily covers up the defect features, making detection difficult. Small size defects on the surface of ceramic, such as micro-cracks and pinholes, are difficult to be recognized by traditional detection methods due to their small size and unobvious features. Flatness defects on the surface of ceramic are difficult to detect. There are problems of low detection efficiency and low accuracy in ceramic surface defect detection. SUMMARY
[0003] The present application aims to at least partly solve one of the above technical problems. To this end, the present application aims to provide a ceramic surface defect detection method, which improves the efficiency and accuracy of ceramic surface defect detection.
[0004] To achieve the above-mentioned purpose, the present application provides a ceramic surface defect detection method, comprising:
[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 a ceramic surface defect detection result.
[0009] According to some embodiments of the present application, the data set labeled with ceramic surface defects is constructed, comprising:
[0010] obtaining an initial data set;
[0011] adjusting the size of ceramic images in the initial data set, and expanding the initial data set based on a data enhancement method to obtain an enhanced data set;
[0012] labeling the enhanced data set with defects using a Labelimg tool to obtain a data set labeled with ceramic surface defects.
[0013] According to some embodiments of the present application, the data enhancement method comprises at least one of horizontal flipping, vertical flipping, and scale transformation processing.
[0014] According to some embodiments of the present application, the ceramic surface image is acquired and input into the target detection model, and a ceramic surface defect detection result is output, comprising:
[0015] The target detection model performs noise reduction processing on the ceramic surface image to obtain an optimized image.
[0016] The optimized image is cropped to obtain a cropped image with a pixel size of m*n;
[0017] The gray value information of each row of pixel points and the gray value information of each column of pixel points in the cropped image are extracted respectively to obtain m+n pieces of gray value data.
[0018] The overall average variance and the overall average value of the m+n pieces of gray value data are calculated.
[0019] The local variance and the local average value of each piece of gray value data are calculated and compared with the overall average variance and the overall average value, and a ceramic surface unevenness detection result is generated when it is determined that the absolute value of the difference between the local variance of at least one piece of gray value data and the overall average variance is greater than a first preset threshold and the absolute value of the difference between the local average value and the overall average value is greater than a second preset threshold.
[0020] According to some embodiments of the present application, the target detection model performs noise reduction processing on the ceramic surface image to obtain an optimized image, comprising:
[0021] The target detection model performs overall noise reduction processing on the ceramic surface image to obtain an initial noise reduction image.
[0022] The target detection model performs local noise reduction processing on the initial noise reduction image to obtain an optimized image.
[0023] According to some embodiments of the present application, the target detection model performs overall noise reduction processing on the ceramic surface image to obtain an initial noise reduction image, comprising:
[0024] The signal-to-noise ratio of the ceramic surface image is calculated.
[0025] The edge region of the ceramic surface image is determined and the gradient value of the edge region is acquired based on the canny edge detection algorithm.
[0026] The signal-to-noise ratio and the gradient value are normalized to determine the corresponding weight coefficient.
[0027] The noise reduction features of the ceramic surface image are calculated based on the signal-to-noise ratio, the gradient value and the corresponding weight coefficient; the first noise reduction coefficient is obtained by querying the preset noise reduction feature-noise reduction coefficient data table based on the noise reduction features, and the ceramic surface image is subjected to overall noise reduction processing to obtain an initial noise reduction image.
[0028] According to some embodiments of the present application, the initial noise reduction image is subjected to local noise reduction processing based on the target detection model to obtain an optimized image, including:
[0029] All noise pixel points in the initial noise reduction image are determined;
[0030] Any noise pixel point is taken as a center pixel point, an N*N region with the center pixel point as a region center is determined as a first region, and an M*M region with the center pixel point as a region center is determined, and the second region is obtained by removing the first region from the M*M region; wherein the M*M region is larger than the N*N region;
[0031] The second noise reduction coefficient of the first region is determined according to the pixel points in the first region and the pixel points in the second region;
[0032] The noise pixel points are subjected to local noise reduction processing according to the second noise reduction coefficient to obtain an optimized image.
[0033] According to some embodiments of the present application, the second noise reduction coefficient of the first region is determined according to the pixel points in the first region and the pixel points in the second region, including:
[0034] The first color feature in the first region and the second color feature in the second region are calculated, the color difference value is determined according to the first color feature and the second color feature, the color noise reduction coefficient of the first region is determined by querying the first noise reduction data table according to the color difference value;
[0035] The first pixel feature in the first region and the second pixel feature in the second region are calculated, the pixel difference value of the first region is determined according to the first pixel feature and the second pixel feature, and the pixel noise reduction coefficient of the second region is determined by querying the second data table according to the pixel difference value;
[0036] The mean value of the color noise reduction coefficient and the pixel noise reduction coefficient is calculated as the second noise reduction coefficient of the first region.
[0037] According to some embodiments of the present application, the ceramic surface image is obtained and input into the target detection model, and the ceramic surface defect detection result is output, including:
[0038] The feature extraction of the ceramic surface image is performed based on the convolutional neural network of the target detection model to obtain a feature map;
[0039] The feature map is processed based on the adaptive thresholding algorithm to obtain a binary image;
[0040] According to the ceramic surface image size, the size of the sliding window is determined, and a plurality of candidate boxes are generated based on the sliding window;
[0041] Each candidate box is mapped to a corresponding position area of the binary image, and the maximum value, minimum value and average value of the pixel points of the position area are determined;
[0042] The scale space corresponding to the candidate box is determined according to the maximum value, minimum value and average value of the pixel points of the position area;
[0043] Along the scale axis of the scale space, the feature pixel points in the candidate box are extracted, the Softmax classification is performed through the cross-entropy loss function, and a plurality of feature pixel point sets are generated;
[0044] The weight information of each feature pixel point set is obtained, the image analysis of the candidate box is performed according to the weight information, and the analysis result of the candidate box is obtained;
[0045] The ceramic surface defect detection result is determined based on the analysis results of the plurality of candidate boxes.
[0046] The present application provides a ceramic surface defect detection method, which realizes accurate identification and detection of ceramic surface defects through steps such as 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 acquiring a ceramic surface image and inputting the model for detection.
[0047] Other features and advantages of the present application will be described in the following description, and some will become apparent from the description, or will be understood by those skilled in the art. The purpose and other advantages of the present application can be achieved and obtained by the structure specifically pointed out in the written description and the accompanying drawings.
[0048] The technical solutions of the present application will be further described in detail below with the help of the accompanying drawings and examples. DETAILED DESCRIPTION
[0049] The accompanying drawings are used to provide a further understanding of the present application, and constitute a part of the specification, together with the embodiments of the present application, to explain the present application, and do not constitute a limitation on the present application. In the drawings:
[0050] Figure 1 is a flowchart of a ceramic surface defect detection method according to an embodiment of the present application;
[0051] Figure 2 is a flowchart of constructing a data set labeled with ceramic surface defects according to an embodiment of the present application;
[0052] Figure 3is a flowchart of outputting a ceramic surface defect detection result according to an embodiment of the present application. DETAILED DESCRIPTION
[0053] The preferred embodiments of the present application are described below in conjunction with the accompanying drawings, it should be understood that the preferred embodiments described here are only used to explain and illustrate the present application, and are not used to limit the present application.
[0054] As shown in Figure 1 An embodiment of the present application proposes a ceramic surface defect detection method, comprising steps S1-S4:
[0055] S1, a data set labeled with ceramic surface defects is constructed;
[0056] S2, a ceramic surface defect detection model is constructed;
[0057] S3, the ceramic surface defect detection model is iteratively trained based on the data set labeled with ceramic surface defects, to obtain a target detection model;
[0058] S4, a ceramic surface image is obtained and input into the target detection model, and a ceramic surface defect detection result is output.
[0059] The working principle of the above technical solution: a large number of ceramic surface images are collected from the ceramic production line, these images should contain various defect types, such as cracks, pinholes, color differences, deformation, etc. Use professional labeling tools or software to manually label the defects in the image. The content of the label can include the type, location, size, etc. of the defect. The ceramic surface defect detection model is YOLOv8n model. Use pre-trained model parameters for initialization to speed up the training speed and improve the model performance. Use the labeled data set to iteratively train the model. In each iteration, a batch of images is input into the model, the loss function is calculated, and the model parameters are updated according to the gradient of the loss function. Optimization algorithms such as stochastic gradient descent (SGD), Adam, etc. can be used in the training process to speed up convergence and improve performance. When the performance of the model on the validation set reaches a satisfactory level, the training is stopped, and the final target detection model is obtained. The ceramic surface image to be detected is input 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 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 the model for detection, etc. Steps, the accurate identification and detection of ceramic surface defects are realized.
[0061] As shown in Figure 2As shown, according to some embodiments of the present application, a data set labeled with ceramic surface defects is constructed, including steps S11-S13:
[0062] S11, obtaining an initial data set;
[0063] S12, adjusting the size of the ceramic image in the initial data set, expanding the initial data set based on a data augmentation method, and obtaining an augmented data set;
[0064] S13, using Labelimg tool to label defects in the augmented data set, and obtaining a data set labeled with ceramic surface defects.
[0065] The working principle of the above technical solution is: the size of the ceramic image in the initial data set is adjusted to ensure that all images have uniform size. The initial data set is expanded by applying a data augmentation method to improve the generalization ability and robustness of the model. Through data augmentation, more ceramic surface images with different changes can be generated, thereby increasing the diversity and richness of the data set. The images after applying the data augmentation method are merged with the images in the initial data set to form an augmented data set. The Labelimg tool is used to label defects in the ceramic images in the augmented data set. A type label is assigned to each labeled defect for subsequent model training and verification.
[0066] The beneficial effects of the above technical solution are: a data set labeled with ceramic surface defects is obtained. This data set will serve as the basis for model training, helping the model to learn the features and rules of ceramic surface defects, thereby achieving accurate recognition and detection of ceramic surface defects.
[0067] According to some embodiments of the present application, 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 application, a ceramic surface image is obtained and input into a target detection model, and a ceramic surface defect detection result is output, 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, the optimized image is cropped to obtain a cropped image with pixel size m*n;
[0071] S43, the gray value information of each row of pixel points and the gray value information of each column of pixel points in the cropped image are extracted respectively to obtain m+n gray value data;
[0072] S44, the overall average variance and overall average value of the m+n gray value data are calculated;
[0073] S45, calculate the local variance and local mean of each gray value data, and compare them with the overall average variance and overall average value respectively, and determine that at least one gray value data exists when the absolute value of the difference between the local variance and the overall average variance is greater than a first preset threshold and the absolute value of the difference between the local mean and the overall average value is greater than a second preset threshold, and generate a detection result of the unevenness of the ceramic surface.
[0074] The working principle of the above technical solution is that the target 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 quality of the image. The cropping operation is to extract the region of interest (ROI) from the optimized image, that is, the specific part of the ceramic surface. Through cropping, the computational amount of subsequent processing can be reduced, and the processing efficiency can be improved. The gray value is the brightness information of the pixel points in the image, which reflects the light and dark degree of the objects in the image. By extracting the gray value information, the texture, color and other characteristics of the ceramic surface can be analyzed. Each row and each column in the cropped image is traversed to extract the gray value of each pixel point. The gray values of each row form a data, and the gray values of each column also form a data, and m+n gray value data are obtained. The overall average variance and the overall average value are statistical quantities describing the overall distribution characteristics of the gray value data. By calculating these statistical quantities, the overall characteristics of the gray value data can be understood and analyzed. The average value and the variance of the m+n gray value data are calculated respectively. The average value reflects the center position of the gray value data, and the variance reflects the dispersion degree of the gray value data. The local variance and the local mean are statistical quantities describing the local distribution characteristics of the gray value data. By calculating these local statistical quantities, the local characteristics of the gray value data can be understood and analyzed. The local variance and the local mean of each gray value data are compared with the overall average variance and the overall average value respectively. If the absolute value of the difference between the local variance and the overall average variance of at least one gray value data is greater than a first preset threshold, and the absolute value of the difference between the local mean and the overall average value is greater than a second preset threshold, it is considered that the ceramic surface has uneven defects. When the above conditions are met, a detection result of the unevenness of the ceramic surface is generated.
[0075] The above technical solution has the beneficial effects that noise reduction, cropping, gray value extraction, statistical quantity calculation and comparison judgment are performed on the ceramic surface image, and finally a detection result of the unevenness of the ceramic surface is generated.
[0076] According to some embodiments of the application, the target detection model performs noise reduction processing on the ceramic surface image to obtain an optimized image, comprising:
[0077] The target detection model performs overall noise reduction processing on the ceramic surface image to obtain an initial noise reduction image;
[0078] The initial denoising image is subjected to local denoising processing based on a target detection model to obtain an optimized image.
[0079] The working principle of the technical solution is that the ceramic surface image is subjected to global denoising processing to remove most of the noise in the image. The overall denoising processing can smooth the image and reduce the influence of high-frequency noise, thereby providing a more stable image basis for subsequent processing. On the basis of the overall denoising, the local area of the image is subjected to further denoising processing. The local denoising processing can finely process the specific area in the image and retain 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 technical solution are that the ceramic surface image denoising processing flow based on the target detection model includes two steps of overall denoising processing and local denoising processing. Through the processing of the two steps, a clearer and more accurate optimized image is obtained.
[0081] According to some embodiments of the present application, the ceramic surface image is subjected to overall denoising processing based on a target detection model to obtain an initial denoising image, which includes:
[0082] The signal-to-noise ratio of the ceramic surface image is calculated.
[0083] The ceramic surface image is subjected to edge detection processing based on a canny edge detection algorithm to determine the edge region of the ceramic surface image and obtain the gradient value of the edge region.
[0084] The signal-to-noise ratio and the gradient value are subjected to normalization processing to determine the corresponding weight coefficient.
[0085] Based on the signal-to-noise ratio, the gradient value and the corresponding weight coefficient, the denoising feature of the ceramic surface image is calculated. Based on the denoising feature, a first denoising coefficient is obtained from a preset denoising feature-denoising coefficient data table, and the ceramic surface image is subjected to overall denoising processing to obtain an initial denoising image.
[0086] The working principle of the above technical solution is: the ceramic surface image is divided into multiple small blocks to facilitate the calculation of the signal-to-noise ratio of each small block. For each small block, the average value of its pixel value is calculated as the signal strength. The standard deviation of the pixel value of each small block is calculated as the noise strength. The signal-to-noise ratio of each small block is calculated using the formula SNR = signal strength / noise strength. The ceramic surface image is converted to a grayscale image to facilitate edge detection. The edge is highlighted by suppressing non-edge pixels. Two thresholds are used to determine edge pixels and connect them into complete edges. According to the edge detection result, the edge region of the ceramic surface image is determined, and the gradient value of these regions is obtained. The signal-to-noise ratio and the gradient value are mapped to a unified normalized range, and the normalized signal-to-noise ratio and the gradient value are used to determine their corresponding weight coefficients. These weight coefficients can reflect the importance of signal-to-noise ratio and gradient value in the denoising process. The normalized signal-to-noise ratio and the gradient value are multiplied by their corresponding weight coefficients to obtain the denoising feature. The denoising feature of each small block is integrated to form the denoising feature of the entire ceramic surface image. A denoising feature-denoising coefficient data table is constructed in advance, which associates the denoising feature with the corresponding denoising coefficient. According to the calculated denoising feature, the data table is queried to obtain the first denoising coefficient.
[0087] The beneficial effects of the above technical solution are: effectively performing overall denoising processing on the ceramic surface image to obtain an initial denoising image with higher clarity and accuracy.
[0088] According to some embodiments of the present application, the initial denoising image is locally denoised based on a target detection model to obtain an optimized image, comprising:
[0089] Determine all noise pixels in the initial denoising image;
[0090] Take any noise pixel as a center pixel, determine an N*N region centered on the center pixel as a first region, and determine an M*M region centered on the center pixel. Remove the first region from the M*M region to obtain a second region. Wherein, the M*M region is larger than the N*N region;
[0091] Determine the second denoising coefficient of the first region according to the pixel points in the first region and the pixel points in the second region;
[0092] Locally denoise the noise pixels according to the second denoising coefficient to obtain an optimized image.
[0093] The working principle of the above technical solution is as follows: Using a noise detection algorithm in the object detection model, the initial denoised image is scanned to identify all possible noise pixels. One of the identified noise pixels is randomly selected as the center pixel. An N*N rectangular region is defined centered on this center pixel as the first region. This region will be used to calculate the second denoising coefficient. A larger M*N rectangular region is then defined centered on the center pixel. The first region is then removed from this M*N region, and the remaining portion is the second region. The second region will be used to assist in calculating the second denoising coefficient of the first region. The second denoising coefficient of the first region is determined based on the pixels in the first and second regions; local denoising processing is then performed on the noise pixels based on the second denoising coefficient to obtain the optimized image.
[0094] The beneficial effects of the above technical solution are: it effectively performs local noise reduction processing on the initial denoised image, resulting in an optimized image with higher clarity and accuracy.
[0095] According to some embodiments of the present invention, determining a second noise reduction coefficient for a first region based on pixels in a first region and pixels in a second region includes:
[0096] Calculate the first color feature in the first region and the second color feature in the second region, and determine the color difference value based on the first color feature and the second color feature; query the first noise reduction data table based on the color difference value to determine the color noise reduction coefficient of the first region;
[0097] 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 based on the first pixel feature and the second pixel feature; then, query the second data table based on the pixel difference value to determine the pixel noise reduction coefficient of the second region.
[0098] The average of the color noise reduction coefficient and the pixel noise reduction coefficient is calculated and used as the second noise reduction coefficient for the first region.
[0099] The working principle of the technical scheme is as follows: for all pixel points in the first region, the color component in the selected color space is calculated, and the first color feature in the first region is calculated. Similarly, the second color feature in the second region is calculated. According to the first color feature and the second color feature, the difference value between them is calculated. A first noise reduction data table is constructed in advance, which associates the color difference value with the corresponding color noise reduction coefficient. According to the calculated color difference value, the first noise reduction data table is queried to obtain the color noise reduction coefficient of the first region. The first pixel feature in the first region and the second pixel feature in the second region are calculated, and the pixel difference value of the first region is determined according to the first pixel feature and the second pixel feature. A second noise reduction data table is constructed in advance, which associates the pixel difference value with the corresponding pixel noise reduction coefficient. According to the calculated pixel difference value, the second noise reduction data table is queried to obtain the pixel noise reduction coefficient of the second region. The color noise reduction coefficient and the pixel noise reduction coefficient are averaged 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. The calculated second noise reduction coefficient is applied to the noise pixel points in the first region for local noise reduction processing.
[0100] The beneficial effects of the above technical scheme are that the second noise reduction coefficient of the first region is more accurately determined, thereby improving the effect of local noise reduction processing.
[0101] According to some embodiments of the application, the first color feature in the first region is calculated, including:
[0102] The RGB color value of all pixel points in the first region is obtained, and the RGB color value includes the R channel value, the G channel value and the B channel value.
[0103] According to the RGB color value of all pixel points, the average value of all pixel points in the R channel, the average value of all pixel points in the G channel and the average value of all pixel points in the B channel in the first region are calculated, and the color feature of the first region is calculated.
[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 B channel value of the i-th pixel point included in the first region.
[0106] The working principle of the technical solution is as follows: according to the preset N*N size, the position and range of the first region in the initial denoising image are determined. For each pixel point in the first region, the R channel value, G channel value and B channel value in the RGB color space are read. The average value of all pixel points in the R channel, the average value of all pixel points in the G channel and the average value of all pixel points in the B channel in the first region are calculated, and the color feature of the first region is calculated. The T value reflects the uniformity and concentration of the color of the first region. When the T value is large, it indicates that the color of the first region is relatively uniform and changes little; when the T value is small, it indicates that the color of the first region changes greatly and may contain noise or edges. In the local denoising process, we can judge whether the first region needs stronger denoising processing according to the size of the T value. If the T value is small, it may mean that the region contains noise or edges and needs more detailed processing.
[0107] The beneficial effects of the technical solution are as follows: the color feature T of the first region can be accurately calculated, which provides strong support for subsequent local denoising processing.
[0108] According to some embodiments of the application, the first pixel feature in the first region is calculated, including:
[0109] The pixel gradient of the first region in the vertical direction and the pixel gradient of the first region in the horizontal direction are obtained, and the pixel feature of the first region is calculated:
[0110]
[0111] Wherein, S is the pixel feature of the first region; D1 is the pixel gradient of the first region in the vertical direction; D2 is the pixel gradient of the first region in the horizontal direction; M θ is the number of pixel points with an angle of θ in the first region; T 1(x) is the pixel gradient of the first region in the vertical direction at x; T 2(x) is the pixel gradient of the first region in the horizontal direction at x; |||0 is the L0 norm, which is used to count the number of non-zero vectors.
[0112] The working principle of the technical solution is as follows: for each pixel point in the first region, the gradient of the pixel point in the vertical direction (y direction) is calculated. This can be realized by comparing the gray value difference between the pixel point and its adjacent pixel points above and below. The vertical gradients of all pixel points are averaged or summed to obtain the vertical gradient. The gradient of each pixel point in the first region in the horizontal direction (x direction) is calculated. The horizontal gradients of all pixel points are averaged or summed to obtain the horizontal gradient. For each pixel point in the first region, the gradient direction angle θ of the pixel point is calculated according to the vertical gradient and the horizontal gradient of the pixel point. This can be realized by the arctangent function arctan(D1 / D2). An angle statistics array or hash table is initialized to record the number of pixel points at different angles θ. All pixel points in the first region are traversed, and the count of the corresponding angle in the angle statistics array or hash table is updated according to the calculated angle θ of the pixel point. The L0 norm of the number of pixel points at all angles θ is calculated, that is, the number of pixel points at different angles is counted. The gradient modulus logarithm is multiplied by the weighted value of the angle statistics to obtain the pixel feature of the first region. The S value integrates the gradient modulus and gradient direction information of the first region, and reflects the texture complexity and directionality of the region. When the S value is large, it indicates that the texture of the first region is complex and may contain more details or edges; when the S value is small, it indicates that the texture of the first region is simple and may be smooth or uniform. In local noise reduction processing, the S value can be used to determine whether the first region needs stronger edge preservation or detail enhancement processing. If the S value is large, it may mean that the region contains important texture information and needs more detailed processing.
[0113] The beneficial effects of the above technical solution are: convenient and accurate determination of the pixel feature of the first region, and improvement of 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 consistent with that for calculating the first color feature and the first pixel feature in the first region.
[0115] According to some embodiments of the present application, a ceramic surface image is obtained and input into a target detection model, and a ceramic surface defect detection result is output, including:
[0116] The convolutional neural network based on the target detection model extracts features from the ceramic surface image to obtain a feature map;
[0117] The feature map is processed based on an adaptive thresholding algorithm to obtain a binary image;
[0118] The size of the recognition sliding window is determined according to the size of the ceramic surface image, and a plurality of candidate boxes are generated based on the sliding window;
[0119] mapping each candidate box to a corresponding position region of the binary image, determining a maximum value, a minimum value and an average value of pixel points of the position region;
[0120] determining a scale space corresponding to the candidate box according to the maximum value, the minimum value and the average value of the pixel points of the position region;
[0121] extracting feature pixel points in the candidate box along a scale axis of the scale space, and generating a plurality of feature pixel point sets through Softmax classification by using a cross-entropy loss function;
[0122] obtaining weight information of each feature pixel point set, and performing image analysis on the candidate box according to the weight information to obtain an analysis result of the candidate box;
[0123] determining a ceramic surface defect detection result based on the analysis results of the candidate boxes.
[0124] The working principle of the above technical solution is that the target detection model fuses multi-scale features through a feature pyramid network to enhance the small defect detection capability. Sauvola algorithm or Niblack method is used to dynamically calculate the threshold value of each local region to adapt to the uneven light problem. Open and close operations are performed on the binary image to eliminate noise points and connect the broken areas.
[0125]
[0126] wherein T(x, y) is the optimized binary image; m(x, y) is the local mean; s(x, y) is the standard deviation; k is a control parameter; and R is a dynamic range.
[0127] A 3-5 layer pyramid is constructed, and the scaling ratio of each layer is increased by root 2, covering the defect scale distribution. Based on K-means clustering, the defect size is counted, and anchor boxes with adaptive aspect ratios (such as 1:2, 1:1, and 2:1) are designed. Integral graph is used to quickly calculate the candidate region statistics, reducing repeated operations. Low-texture areas are filtered through edge density analysis to reduce invalid candidate boxes.
[0128] querying a preset maximum value-minimum value-average value-scale space data table according to the maximum value, the minimum value and the average value of the pixel points of the position region to determine a Gaussian pyramid: performing multi-scale smoothing on the candidate region to generate a scale sequence.
[0129] Feature quantization: calculate local contrast (LCP), entropy value, edge density and other statistical features at each scale. Through principal component analysis (PCA), low-dimensional feature vectors are generated.
[0130] A Depthwise Separable convolution is used to construct a classification network, and the number of parameters is reduced to 1 / 9 of that of a conventional convolution.
[0131] Loss function improvement:
[0132] L = lambda1L CE + lambda2L Dice
[0133] Wherein, L is the improved loss function; L CE is the cross-entropy loss; lambda1 is the first weight; lambda2 is the second weight; L Dice is the Dice loss. Combining cross-entropy and Dice loss solves the class imbalance problem.
[0134] Learn the spatial attention map through the Transformer encoder: perform Softmax classification to generate a plurality of feature pixel point sets; obtain the weight information of each feature pixel point set, and perform image analysis on the candidate frame according to the weight information to obtain the analysis result of the candidate frame; and determine the ceramic surface defect detection result based on the analysis results of a plurality of candidate frames.
[0135] The beneficial effects of the above technical solutions are: while maintaining the detection accuracy, the computational complexity is significantly reduced, and the accuracy of determining the ceramic surface defect detection result is improved.
[0136] Obviously, those skilled in the art can make various modifications and variations to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application also intends to include these modifications and variations.
Claims
1. A method for detecting defects on ceramic surfaces, characterized in that, include: Construct a dataset labeled with ceramic surface defects; Construct a ceramic surface defect detection model; The ceramic surface defect detection model is iteratively trained based on a dataset labeled with ceramic surface defects to obtain the target detection model; Acquire images of the ceramic surface and input them into the target detection model to output the ceramic surface defect detection results; Acquire images of the ceramic surface and input them into the target detection model. Output the ceramic surface defect detection results, including: A convolutional neural network based on an object detection model is used to extract features from ceramic surface images to obtain feature maps. The feature map is processed using an adaptive thresholding algorithm to obtain a binary image. The size of the recognition sliding window is determined based on the size of the ceramic surface image, and several candidate boxes are generated based on the sliding window; Map each candidate box to the corresponding location region in the binary image, and determine the maximum, minimum, and average values of the pixels in the location region; The scale space corresponding to the candidate box is determined based on the maximum, minimum, and average values of the pixels in the location region. Along the scale axis of the scale space, feature pixels in the candidate boxes are extracted, and softmax classification is performed using the cross-entropy loss function to generate multiple sets of feature pixels. Obtain the weight information of each feature pixel set, and perform image parsing on the candidate boxes based on the weight information to obtain the parsing results of the candidate boxes; The results of ceramic surface defect detection are determined based on the analysis results of several candidate boxes.
2. The ceramic surface defect detection method as described in claim 1, characterized in that, Construct a dataset labeled with ceramic surface defects, including: Obtain the initial dataset; The sizes of the ceramic images in the initial dataset are adjusted, and the initial dataset is expanded using data augmentation methods to obtain the augmented dataset; The Labelimg tool was used to annotate the augmented dataset, resulting in a dataset labeled with ceramic surface defects.
3. The ceramic surface defect detection method as described in claim 2, characterized in that, The data augmentation method includes at least one of horizontal flipping, vertical flipping, and scaling transformation.
4. The ceramic surface defect detection method as described in claim 1, characterized in that, Acquire images of the ceramic surface and input them into the target detection model. Output the ceramic surface defect detection results, including: The target detection model performs noise reduction processing on the ceramic surface image to obtain an optimized image; The optimized image is cropped to obtain a cropped image with a pixel size of m*n; Extract the grayscale value information of each row and each column of pixels in the cropped image to obtain m+n grayscale value data. Calculate the overall average variance and overall average value of m+n grayscale data points; 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 the absolute value of the difference between the local variance and the overall average variance of at least one grayscale value data is greater than the first preset threshold and the absolute value of the difference between the local mean and the overall average value is greater than the second preset threshold, the detection result of uneven ceramic surface is generated.
5. The ceramic surface defect detection method as described in claim 4, characterized in that, The object detection model performs noise reduction on the ceramic surface image to obtain an optimized image, including: The ceramic surface image is denoised based on the target detection model to obtain the initial denoised image. The initial denoised image is locally denoised based on the object detection model to obtain an optimized image.
6. The ceramic surface defect detection method as described in claim 5, characterized in that, The ceramic surface image is subjected to overall noise reduction based on the target detection model to obtain the initial noise-reduced image, including: Calculate the signal-to-noise ratio of a ceramic surface image; Edge detection processing of ceramic surface images is performed based on the Canny edge detection algorithm to determine the edge regions of the ceramic surface images and obtain the gradient values of the edge regions; Normalize the signal-to-noise ratio and gradient values to determine the corresponding weight coefficients; Based on the signal-to-noise ratio, gradient value, and corresponding weight coefficients, the denoising features of the ceramic surface image are calculated. Based on the denoising features, the preset denoising feature-denoising coefficient data table is queried to obtain the first denoising coefficient. The ceramic surface image is then subjected to overall denoising processing to obtain the initial denoised image.
7. The ceramic surface defect detection method as described in claim 5, characterized in that, Based on the object detection model, local denoising is performed on the initial denoised image to obtain an optimized image, including: Identify all noisy pixels in the initial denoised image; Taking any noise pixel as the center pixel, determine an N*N region centered on the center pixel as the first region; determine an M*M region centered on the center pixel, and remove the first region from the M*M region to obtain the second region; wherein, the M*M region is larger than the N*N region. The second noise reduction coefficient of the first region is determined based on the pixels in the first region and the pixels in the second region; The noise pixels are locally denoised based on the second denoising coefficient to obtain an optimized image.
8. The ceramic surface defect detection method as described in claim 7, characterized in that, The second noise reduction coefficient for the first region is determined based on the pixels in the first region and the pixels in the second region, including: Calculate the first color feature in the first region and the second color feature in the second region, and determine the color difference value based on the first color feature and the second color feature; query the first noise reduction data table based on the color difference value to determine 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 based on the first pixel feature and the second pixel feature; then, query the second data table based on the pixel difference value to determine the pixel noise reduction coefficient of the second region. The average of the color noise reduction coefficient and the pixel noise reduction coefficient is calculated and used as the second noise reduction coefficient for the first region.
Citation Information
Patent Citations
Bathroom ceramic surface defect detection method and device based on deep learning
CN110826416A
Bathroom ceramic surface defect detection method
CN114066817A
Improved YOLOv3-based bathroom ceramic defect detection method
CN115705642A
Ceramic ball surface defect detection method and system, electronic equipment and medium
CN119205669A
Surface defect detection method and equipment for ceramic component
CN119649137A