A Machine Learning-Based Method for Detecting Surface Defects in Folding Tables

By using machine learning-based methods, combining grayscale feature values ​​and skeleton line features, defect areas on the surface of folding tables are identified, solving the problems of texture interference and inaccurate identification of multiple types of defects in existing technologies, and achieving high-precision defect detection and classification.

CN123118447APending Publication Date: 2026-11-17ZHEJIANG YEZHULIN LEISURE PRODUCTS CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202611021487.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-09
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

Existing technologies are easily affected by inherent textures in furniture surface defect detection, making it difficult to achieve precise identification of multiple types of defects. Furthermore, the detection results are easily affected by subjective factors, lacking consistency and digital storage.

Method used

A machine learning-based approach is adopted. By acquiring and preprocessing images of the folding table surface, candidate defect sub-regions are selected using grayscale feature values. The curvature change, linear extension, and undulation dispersion of the skeleton line are combined to distinguish scratches and dents. Mixed defects are identified by morphological heterogeneity. The machine learning model is then trained to improve detection accuracy.

Benefits of technology

It effectively eliminates texture artifacts and false alarms, ensuring accurate identification of dents, scratches, and mixed defects, meeting the industrial production line's demand for high-precision, low-miss-detection surface quality inspection, and realizing fine classification and automated detection of multiple types of defects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123118447A_ABST
    Figure CN123118447A_ABST
Patent Text Reader

Abstract

This invention relates to the field of image processing technology, and more particularly to a machine learning-based method for detecting surface defects on folding tables. The method includes acquiring several surface images of the folding table and processing them into smooth images; determining several candidate defect sub-regions based on the grayscale feature values ​​of the smoothed images, and determining defect regions based on the average curvature change values ​​of the candidate defect sub-regions; determining scratch-type or dent-type defects based on the linear extension and undulation dispersion of the defect region's skeleton lines, and determining mixed-type defects based on morphological heterogeneity; dividing training samples into training and validation sets and inputting them into a machine learning model for training to obtain a surface defect detection model; inputting the validation set into the surface defect detection model to determine the detection accuracy of the surface defect detection model based on confidence level. This invention solves the problem in existing technologies where the model is easily affected by inherent texture interference, making it difficult to achieve refined identification of multiple types of defects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and in particular to a method for detecting surface defects on a folding table based on machine learning. Background Technology

[0002] Traditional defect detection methods have long relied on manual visual inspection. However, manual inspection has many inherent limitations: its efficiency declines significantly with working hours, inspection standards are easily influenced by subjective factors and lack consistency, and the results cannot be digitally stored and traced. With the rapid development of computer vision and machine learning, machine vision-based surface defect detection technology has gradually become the mainstream solution to replace manual inspection. However, the threshold obtained by existing technologies through grayscale histograms is relatively fixed and cannot adaptively cope with image changes under different lighting conditions and texture backgrounds. When the grayscale distribution of furniture surfaces is complex, it is difficult to obtain accurate scratch areas using this fixed threshold for segmentation. In traditional grayscale histogram-based segmentation methods, the segmentation threshold for scratch areas depends entirely on the overall grayscale distribution statistics of the image, failing to fully consider potential noise interference in the image.

[0003] Chinese Patent Application Publication No. CN118823029B discloses a method for detecting the surface quality of furniture based on machine vision. This application relates to the field of image data processing technology, and particularly to a method for detecting the surface quality of furniture based on machine vision. The method includes: acquiring a target grayscale image of the surface to be inspected of the target furniture, and determining a first number of other pixels in the target grayscale image with the same grayscale value as the target pixel; determining a first parameter value of the target pixel based on the grayscale values ​​of other pixels in the neighborhood of the target pixel and the first number; determining a gradient feature difference value between the target pixel and other pixels in the neighborhood, and determining a second parameter value of the target pixel based on the first parameter value and the gradient feature difference value; using the second parameter value of the target pixel to perform saliency detection on the target grayscale image to obtain a salient region in the target grayscale image, and using the salient region as the scratch region of the surface to be inspected. Through the above technical solution, more accurate scratch regions on the surface of the furniture can be determined.

[0004] The existing technology also has the following problems: it is easily affected by inherent textures, and the accuracy of classification and recognition of scratches, dents and mixed defects is poor, making it difficult to achieve fine recognition of multiple types of defects. Summary of the Invention

[0005] To address this, the present invention provides a machine learning-based method for detecting surface defects on folding tables, thereby overcoming the problem in existing technologies that are susceptible to interference from inherent textures and struggle to achieve refined identification of multiple types of defects.

[0006] To achieve the above objectives, the present invention provides a machine learning-based method for detecting surface defects in a folding table, comprising: Acquire surface images of several folding tables, and preprocess these surface images to obtain smooth images; Several candidate defect sub-regions are determined based on the gray-level feature values ​​of several sub-regions of the smooth image and a preset gray-level threshold, and the defect region is determined based on the average curvature change value of the candidate defect sub-regions. The defect type is determined based on the linear extension and undulation dispersion of the skeleton line of the defect region. If the defect cannot be determined as a scratch or dent, a mixed defect is determined based on the morphological heterogeneity of the defect region. A single surface image and its defect discrimination result label are paired to form training samples. Several samples are divided into training set and validation set. The training set is input into the machine learning model for training to obtain the surface defect detection model. The validation set is input into the surface defect detection model to determine the detection accuracy of the surface defect detection model based on the confidence level.

[0007] Furthermore, the candidate defect sub-region is determined based on a grayscale feature value that is less than a preset grayscale threshold, wherein the grayscale feature value is the arithmetic mean of the grayscale values ​​of all pixels in a single sub-region.

[0008] Furthermore, the defect region is determined based on the fact that the average curvature change value of the skeleton line of the candidate defect sub-region is greater than or equal to a preset average curvature change value.

[0009] Furthermore, the average curvature change value is determined based on the turning interior angle of an adjacent line segment formed by sequentially selecting three consecutive pixels on the skeleton line.

[0010] Furthermore, the defect types include scratch defects and dent defects, wherein, The scratch-type defects are determined based on the linear extension of the skeleton line being greater than or equal to a first preset linear extension and the undulation dispersion being less than or equal to a first preset undulation dispersion. The depression-type defect is determined based on the linear extension being less than or equal to a second preset linear extension and the undulation dispersion being greater than or equal to a second preset undulation dispersion.

[0011] Furthermore, the linear elongation is the ratio of the extension length of the skeleton line of the defect area to the average width in the vertical direction of the extension length, which is used to distinguish between the long strip-like structure of scratches and the block-like structure of depressions without elongation.

[0012] Furthermore, the fluctuation dispersion is the gray-level variance of the defect area, used to distinguish between smooth and irregular gray-level distributions on scratched surfaces.

[0013] Furthermore, the defect types also include hybrid defects, wherein, The hybrid defects are determined based on the morphological heterogeneity being greater than or equal to a preset morphological heterogeneity.

[0014] Furthermore, the morphological heterogeneity is determined based on the absolute value of the difference in grayscale variance between sub-blocks within the defective region, and is used to measure the degree of spatial heterogeneity of the defective region.

[0015] Furthermore, if the detection accuracy of the surface defect detection model is unqualified, the confidence level output by the current surface defect detection model is determined to be less than the preset confidence level; and the preset grayscale threshold is adjusted based on the current confidence level.

[0016] Compared with the prior art, the beneficial effects of the present invention are that it combines sub-region grayscale initial screening, skeleton line curvature verification, multi-level morphological feature classification and model optimization, which effectively eliminates texture artifacts and false alarms while ensuring accurate identification of dents, scratches and mixed defects, thus meeting the needs of industrial production lines for high-precision, low-miss-detection surface quality inspection.

[0017] Furthermore, this invention divides a smooth image into several sub-regions with equal area, quickly filters candidate defect sub-regions by comparing the gray-scale feature values ​​of the sub-regions with a preset gray-scale threshold, extracts the skeleton lines of the candidate defect sub-regions and calculates the average curvature change value, and utilizes the geometric difference between the long, continuous, and smooth skeleton lines of real defects and the short and broken skeleton lines of texture misjudgment areas to effectively preserve real defects, significantly improve the accuracy of defect area determination, and suppress false alarms caused by wood grain, stains, uneven lighting, etc.

[0018] Furthermore, this invention extracts the linear extension and undulation dispersion of the skeleton lines in the defect area, which can accurately distinguish between scratch-type defects and dent-type defects. For defect areas that cannot be classified into the above two categories, the morphological heterogeneity is obtained by calculating the absolute value of the difference in gray-level variance between each sub-block in the defect area. Areas with large morphological heterogeneity are classified as mixed defects, thereby achieving fine classification of scratches, dents and mixed defects.

[0019] Furthermore, this invention pairs a single surface image with its defect discrimination result label to form training samples, trains a machine learning model, and uses the confidence level on the validation set as the pass / fail standard. When the confidence level is not up to standard, the screening conditions of candidate defect sub-regions are optimized by adjusting the preset grayscale threshold, so that the model can continuously evolve during training and achieve the optimal balance between defect capture capability and false alarm control. Attached Figure Description

[0020] Figure 1This is a flowchart of a machine learning-based surface defect detection method for folding tables according to an embodiment of the present invention; Figure 2 This is a flowchart illustrating the process of determining candidate defect sub-regions in an embodiment of the present invention; Figure 3 A flowchart for determining the defect region in an embodiment of the present invention; Figure 4 A flowchart for determining hybrid defects in an embodiment of the present invention; Figure 5 This is a flowchart for determining the accuracy of the surface defect detection model in an embodiment of the present invention. Detailed Implementation

[0021] To make the objectives and advantages of the present invention clearer, the present invention will be further described below with reference to embodiments; it should be understood that the specific embodiments described herein are merely for explaining the present invention and are not intended to limit the present invention.

[0022] Preferred embodiments of the present invention will now be described with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are merely illustrative of the technical principles of the present invention and are not intended to limit the scope of protection of the present invention.

[0023] The present invention will now be described in a clear and detailed manner with reference to the accompanying drawings.

[0024] Please see Figures 1-5 As shown, Figure 1 This is a flowchart of a machine learning-based surface defect detection method for folding tables according to an embodiment of the present invention; Figure 2 This is a flowchart illustrating the process of determining candidate defect sub-regions in an embodiment of the present invention; Figure 3 A flowchart for determining the defect region in an embodiment of the present invention; Figure 4 A flowchart for determining hybrid defects in an embodiment of the present invention; Figure 5 This is a flowchart for determining the accuracy of the surface defect detection model in an embodiment of the present invention.

[0025] The present invention provides a machine learning-based method for detecting surface defects on folding tables, comprising: Step S1: Obtain surface images of several folding tables, and preprocess the surface images to obtain smooth images; Step S2: Based on the gray-level feature values ​​of several sub-regions of the smoothed image and a preset gray-level threshold, several candidate defect sub-regions are determined, and the defect region is determined based on the average curvature change value of the candidate defect sub-regions. Step S3: Determine the defect type based on the linear extension and undulation dispersion of the skeleton line of the defect region. If it cannot be determined to be a scratch or dent defect, determine a mixed defect based on the morphological heterogeneity of the defect region. Step S4: Pair a single surface image with its defect discrimination result label to form a training sample. Divide several samples into a training set and a validation set. Input the training set into the machine learning model for training to obtain the surface defect detection model. Step S5: Input the validation set into the surface defect detection model to determine the detection accuracy of the surface defect detection model based on the confidence level.

[0026] In this embodiment of the invention, several surface images of folding tables with defects are obtained by artificially simulating defects on a defect-free tabletop and collecting samples of original defects from the production process. An LED ring light source is used, the light incident angle is set to 45°, and the camera lens is 30cm vertically away from the tabletop for image acquisition. All tabletop image parameters mentioned in this article are acquired under the above conditions.

[0027] Specifically, the surface image of the folding table is an RGB three-channel color image, which is converted into an 8-bit single-channel grayscale image. This is existing technology and will not be elaborated further.

[0028] Specifically, the grayscale image is first enhanced using the CLAHE algorithm. The key parameters of the algorithm are set as follows: clipLimit is 2.0-4.0, and tileGridSize is 8×8-16×16. The enhanced image is then subjected to adaptive Gaussian filtering for noise reduction. The filter kernel is adaptively selected to be 3×3 or 5×5 in size, which can suppress high-frequency noise while preserving the complete edge contour of defects, and obtain a smooth image with a smooth grayscale transition.

[0029] In this embodiment of the invention, candidate defect sub-regions are determined by grayscale feature values, enabling rapid initial screening of defects. There is a layered boundary between the grayscale distribution of the defect-free substrate and the defect area on the surface of the folding table. The surface of the normal substrate has uniform overall reflection and a higher grayscale value; while the defect area has a lower grayscale value due to reduced diffuse reflection of light or changes in surface structure. This allows for the rapid screening of candidate defect sub-regions with lower grayscale values ​​while effectively eliminating a large area of ​​normal background.

[0030] In a preferred embodiment of the present invention, the candidate defect sub-region is determined based on the gray-scale feature value being less than a preset gray-scale threshold.

[0031] This invention also includes defining a single sub-region whose grayscale feature value is greater than or equal to a preset grayscale threshold as a defect-free sub-region.

[0032] Specifically, the grayscale feature value is the arithmetic mean of the grayscale values ​​of all pixels in a single sub-region.

[0033] In this embodiment of the invention, the smooth image is divided into several sub-regions with equal area.

[0034] In a preferred embodiment of the present invention, the smoothed image is divided into several sub-regions with equal area, using 0.01 times the side length of the smoothed image as a fixed size.

[0035] In an optional embodiment of the present invention, the preset grayscale threshold is set to 180. For machine vision inspection of a folding table surface, the smoothed image pixel grayscale value ranges from 0 to 255. The normal substrate surface of the folding table appears generally brighter after imaging, with grayscale values ​​concentrated in the 180-240 range. Defective sub-regions, due to reduced diffuse reflection, have lower overall grayscale, with pixel grayscale values ​​mostly distributed in the 30-179 range, exhibiting clear grayscale stratification boundaries. A sliding window is used to discriminate the average grayscale value of the sub-regions. After multiple sets of comparative experiments, the optimal threshold is determined, with grayscale thresholds set to 170, 175, 180, 185, and 190 respectively. The results show that when the threshold is set to 180, it can accurately distinguish between normal substrate sub-regions and sub-regions suspected of containing defects, effectively eliminating irrelevant background areas while completely preserving all potential defect areas. However, the above values ​​are only examples; those skilled in the art can choose values ​​according to actual needs.

[0036] In this embodiment of the invention, after the candidate defect sub-regions are screened, the eight-connectivity rule is used to merge the candidate defect sub-regions that are spatially adjacent and belong to the same candidate defect, forming a completely connected candidate defect sub-region.

[0037] In this embodiment of the invention, the average curvature change value is used to characterize the overall bending and twisting degree of the skeleton line, effectively suppressing false detections caused by the inherent texture and fine lines of the desktop, and improving the accuracy of candidate defect sub-region screening. The skeleton line of a real defect is a long continuous strip or a smooth arc, with an overall direction close to a straight line, few bends at a single point, large included angle values, and a larger average curvature change value. In contrast, in the false judgment areas caused by the inherent texture of the desktop and uneven lighting, the skeleton line is short and broken, with frequent sharp angle turns, small included angle values, and a smaller average curvature change value.

[0038] In a preferred embodiment, the defect region is determined based on the fact that the average curvature change value of the skeleton line of the candidate defect sub-region is greater than or equal to a preset average curvature change value.

[0039] This embodiment of the invention further includes determining the candidate defect sub-region where the average curvature change value of the skeleton line is less than the preset average curvature change value as the misjudged region.

[0040] In this embodiment of the invention, the Zhang-Suen thinning algorithm can be used to extract the skeleton lines of the candidate defect sub-regions, and the specific method is not limited.

[0041] In an optional embodiment of the present invention, the preset average curvature change value is 135°. For 500 real defects and 300 texture misjudgment areas on the surface of the folding table, the average curvature change value of the skeleton lines is calculated. The skeleton lines of real scratches and dents are long, continuous, and smooth, and are close to straight lines. The average curvature change value is generally distributed in the range of 140°-160°. The average curvature change value of misjudgment areas caused by wood grain and uneven lighting is mostly concentrated in the range of 60°-130°. Experiments show that when the preset average curvature change value is 135°, the retention rate of real defects reaches 96.5%, and the misjudgment rejection rate reaches 93.2%.

[0042] In this embodiment of the invention, the average curvature change value is determined based on the turning interior angle of an adjacent line segment composed of three consecutive pixels selected sequentially on the skeleton line.

[0043] In a preferred embodiment, three consecutive pixels are selected sequentially along the skeleton line of the candidate defect sub-region to form two adjacent line segments. The included angle between the adjacent line segments is calculated. The included angle is calculated for each combination of three consecutive points on the skeleton line. The sum of all included angle values ​​is divided by the total number of included angles. The average included angle is the average curvature change value. The included angle is the turning interior angle between adjacent line segments.

[0044] In this embodiment of the invention, the defect types include scratch defects and dent defects, wherein, The scratch-type defects are determined based on the linear extension of the skeleton line being greater than or equal to a first preset linear extension and the undulation dispersion being less than or equal to a first preset undulation dispersion. The depression-type defect is determined based on the linear extension being less than or equal to a second preset linear extension and the undulation dispersion being greater than or equal to a second preset undulation dispersion.

[0045] Specifically, the first preset linear extension is greater than the second preset linear extension, and the first preset fluctuation dispersion is less than the second preset fluctuation dispersion.

[0046] In an optional embodiment of the present invention, the first preset linear elongation value is 8.0. For scratch-like defects on the surface of a folding table, the ratio of the extension length of the skeleton line in the defect area to the average lateral width of the skeleton line is usually large. 500 typical scratch samples of different lengths and widths were collected, and the linear elongation distribution was statistically analyzed. The results showed that more than 80% of the scratch samples had a linear elongation greater than 8.0, while the linear elongation of dent-like defects was generally less than 3. In the experiment, the first preset linear elongation was set to 6.0, 7.0, 8.0, 9.0, and 10.0 respectively. Using scratch recognition accuracy as the evaluation index, it was verified that when the value was 8.0, the scratch detection rate reached 97.2%. The first preset fluctuation dispersion value is set to 60. Scratch-type defects have relatively smooth surfaces and small grayscale fluctuation dispersion. The fluctuation dispersion was calculated for 300 scratch samples. The results show that the fluctuation dispersion value of 95% of the samples is lower than 60. However, due to the uneven texture, the fluctuation dispersion value of dent-type defects is generally higher than 180. The experiment set the first preset fluctuation dispersion value to 40, 50, 60, 70, and 80, and combined it with the first preset linear extension value of 8.0 for joint determination. The results show that when the value is 60, the accuracy of scratch recognition reaches 96.5%. The second preset linear elongation value is 3. Depression defects are blocky or hemispherical and have a small linear elongation. 400 typical depression samples were collected, including shallow depressions, deep pits, and indentations. Their linear elongation distribution was statistically analyzed. More than 85% of the depression samples had a linear elongation of less than 3, while the linear elongation of the scratch samples was greater than 8.0. The experiment set the second preset linear elongation values ​​to 2.0, 2.5, 3, 3.5, and 4.0. The depression recognition accuracy rate was used as the indicator. When the value was 3, the depression detection rate reached 96.8%, and short and thick scratches were not misjudged as depressions. The second preset fluctuation dispersion value is set to 185. Due to the significant fluctuations in surface grayscale, dent defects exhibit a much higher fluctuation dispersion than scratches. Calculations of the fluctuation dispersion for 400 dent samples revealed that 80% of the samples had a fluctuation dispersion greater than 185, while the maximum fluctuation dispersion for scratch samples did not exceed 60. Experiments were conducted with the second preset fluctuation dispersion values ​​set to 165, 175, 185, 195, and 210, combined with the second preset linear extension value of 3. When the value was 185, the accuracy of dent classification reached 96.2%, effectively eliminating interference from false dents caused by uneven illumination. However, the above values ​​are merely illustrative examples; those skilled in the art can choose values ​​according to actual needs.

[0047] Specifically, a defect-free desktop surface is smooth with minimal undulations, while scratch-type defects are long strips with regular orientations and surface undulations concentrated only at the two edges. Depression-type defects are local depressions with no obvious linear extension and overall undulations that are discrete and chaotic. The linear extension can characterize the linear extension shape of the defect skeleton, while the undulation dispersion reflects the intensity of pixel grayscale fluctuations through grayscale variance.

[0048] In this invention, the linear extension is determined based on the extension length of the skeleton line and the average width in the direction perpendicular to the extension length.

[0049] In an optional embodiment of the present invention, the linear elongation is the ratio of the extension length of the skeleton line of the defect area to the average width in the vertical direction of the extension length, which is used to distinguish between the long strip-like structure of scratches and the block-like structure of depressions without elongation.

[0050] In this invention, the fluctuation dispersion is the gray-level variance of the defect area, used to distinguish between smooth and irregular gray-level distributions on the scratched surface.

[0051] In this embodiment of the invention, during the production process, if the tabletop is contaminated with oil, ink, or has local color differences or uneven paint thickness at the joints of the veneer material, it will appear as a darker spot with a different gray level than the surrounding area, but the internal gray level is relatively uniform. However, it is not a normal tabletop texture. At the same time, after the folding table is painted, the small bumps or small dots left after the bubbles burst are usually dot-shaped, small in area and relatively uniform in gray level. Such defects do not conform to the linear extension characteristics of scratches, nor do they conform to the undulating and discrete characteristics of depressions. Such defects are defined as unclassified defects. After excluding scratch and dent defects, the core difference among the remaining defects lies only in the uniformity of their internal grayscale distribution. Mixed defects contain both scratch and dent feature areas, with significant differences in their local grayscale variances. In contrast, unclassified defects exhibit consistent internal grayscale variations. Scratches, dents, and mixed defects directly affect the structural strength and appearance of the folding table and require clear classification to guide rework or scrapping. Unclassified defects, on the other hand, typically do not affect usability, are varied in shape, and occur infrequently. Therefore, they do not require detailed classification and can be manually confirmed after marking. This approach ensures the automated detection rate of major defects while avoiding the complexity and risk of misjudgment caused by excessive engineering.

[0052] In this embodiment of the invention, when the surface defects of the folding table are determined not to be simple scratches or simple dents, morphological heterogeneity is introduced for discrimination. This is used to characterize the spatial heterogeneity of the texture and gray-scale fluctuations within the defect area. By utilizing the characteristics of mixed defects that simultaneously possess both linear scratch features and undulating dent features, as well as significant differences in gray-scale variance between sub-regions, they can be clearly distinguished from the characteristics of single defect areas that have uniform morphology and weak variance differences. This allows for the differentiation of mixed defects that possess both dual defect characteristics.

[0053] Specifically, the following are not considered scratch-type or dent-type defects: the linear extension is less than the first preset linear extension but greater than the second preset linear extension; the undulation dispersion is greater than the first preset undulation dispersion but less than the second preset undulation dispersion; the linear extension is greater than or equal to the first preset linear extension and the undulation dispersion is greater than the first preset undulation dispersion; the linear extension is less than or equal to the second preset linear extension and the undulation dispersion is less than the second preset undulation dispersion.

[0054] In this invention, the defect type also includes hybrid defects, wherein, The hybrid defects are determined based on the morphological heterogeneity being greater than or equal to a preset morphological heterogeneity.

[0055] Specifically, it also includes classifying defect types in defect regions with morphological heterogeneity less than a preset morphological heterogeneity as unclassified defects.

[0056] In this embodiment of the invention, the morphological heterogeneity is determined based on the absolute value of the difference in grayscale variance between sub-blocks within the defective region, and is used to measure the degree of spatial heterogeneity of the defective region.

[0057] As a preferred embodiment, for defect areas that do not belong to scratch-type defects or dent-type defects, a single defect area is divided into four sub-blocks of equal area: upper left, upper right, lower left, and lower right. The local gray-level variance of all pixels in each sub-block is calculated. The four local gray-level variances are paired up, and the absolute value of the difference between each pair of local gray-level variances is calculated. The ratio of the standard deviation to the average value of all the absolute values ​​of the differences is determined as the morphological heterogeneity. Specifically, the pairing methods are as follows: the top left sub-block is paired with the top right sub-block, the top left sub-block is paired with the bottom left sub-block, the top left sub-block is paired with the bottom right sub-block, the top right sub-block is paired with the bottom left sub-block, the top right sub-block is paired with the bottom right sub-block, and the bottom left sub-block is paired with the bottom right sub-block.

[0058] In an optional embodiment of this invention, the preset morphological heterogeneity value is 0.25. For the defect area on the surface of a folding table, a large number of defect samples were collected, including pure scratches, pure dents, and mixed defects exhibiting both scratch and dent characteristics. The morphological heterogeneity of all samples was calculated. The results showed that pure scratches and pure dents had uniform internal texture and grayscale morphology, with small differences in grayscale variance among sub-blocks. Mixed defects contained both linear scratches and local dent structures, with significant differences in grayscale fluctuations and texture morphology among sub-regions. Through cross-validation with multiple sets of samples, comparative tests were conducted with preset morphological heterogeneity values ​​of 0.15, 0.2, 0.25, 0.3, and 0.35. When the value was 0.25, it could accurately distinguish between single-type defects and mixed defects, and effectively avoid misjudgments caused by weak light fluctuations and subtle tabletop textures, achieving the best accuracy in identifying mixed defects. However, the above values ​​are only illustrative examples, and those skilled in the art can choose values ​​according to actual needs.

[0059] In this embodiment of the invention, a single image of the surface of a folding table and its corresponding defect discrimination label constitute a single image sample. All samples are randomly divided into a training set and a validation set at a ratio of 7:3. The division is carried out by a hierarchical random shuffling method to ensure that the distribution ratio of each type of defect in the training set and the validation set is consistent with the original dataset, so as to avoid the model overfitting or underfitting due to uneven sample distribution. At the same time, it ensures that the two sets can fully cover images with different defect types, different lighting conditions, and different defect degrees. The training set images are directly input into the convolutional neural network, along with the corresponding real labels, to output the predicted probabilities of each category. By minimizing the classification loss function and optimizing the network weight parameters using the backpropagation algorithm, the trained surface defect detection model is finally obtained. The machine learning model can be a convolutional neural network. After inputting the training set image, it sequentially passes through a convolutional layer with 3 kernels (3×3) and 32, 64, and 128 channels, a pooling layer, 2 fully connected layers, and a Softmax layer to output 5 classes of probabilities. The training uses cross-entropy loss, an Adam optimizer with a learning rate of 0.001, a batch size of 32, and 50 iterations. Alternatively, it can be VisionMamba or ConvNeXt with the same hyperparameter settings, without any specific limitation.

[0060] In this embodiment of the invention, the confidence level judgment process is based on the pre-labeled real labels and the prediction results automatically output by the model. The process involves automated batch comparison and statistics through program scripts or code, and then the confidence level is used to determine whether the surface defect detection model is qualified. When the model confidence level reaches the preset confidence level, it indicates that the model has excellent defect capture capability and false alarm control capability. If the confidence level does not meet the standard, the parameter adjustment or retraining mechanism will be automatically triggered to avoid batch missed detections or excessive downtime caused by unqualified models going online. This ensures the bottom line of quality control while taking into account production line efficiency and cost control.

[0061] In a preferred embodiment of the present invention, the validation set is input into the surface defect detection model to determine the detection accuracy of the surface defect detection model based on the confidence level.

[0062] In a preferred embodiment of the present invention, if the detection accuracy of the surface defect detection model is unqualified, it is determined that the confidence level output by the current surface defect detection model is less than the preset confidence level.

[0063] The embodiments of the present invention also include that the detection accuracy of the surface defect detection model is qualified, which is determined based on the confidence level being greater than or equal to a preset confidence level; The confidence level is the ratio of the number of validation set images with correct model detection results to the total number of validation set images.

[0064] In a preferred embodiment of the present invention, the preset confidence level is set to 0.97. For the surface defect detection task of folding tables, a total of 12,000 surface images, including those with no defects, scratches, dents, mixed defects, and unclassified defects, are collected and divided into training and validation sets in a 7:3 ratio. A convolutional neural network is used as the surface defect detection model. Model pass / fail determination experiments are conducted with confidence thresholds set to 0.90, 0.93, 0.95, 0.97, and 0.99, respectively. The comprehensive performance of the model in actual production line applications is used as the evaluation index. Experimental results show that when the confidence level is 0.97, the production line pass rate reaches 96.8%, and all indicators meet industrial quality inspection requirements. The model achieves an optimal balance between defect detection capability and false alarm control, preventing excessive review waste caused by excessively high thresholds. However, the above values ​​are only illustrative examples, and those skilled in the art can choose values ​​according to actual needs.

[0065] In a preferred embodiment of the present invention, a pre-established correspondence between a preset grayscale threshold and the confidence level is constructed. This relationship characterizes a bidirectional tentative adjustment mechanism of the preset grayscale threshold when the confidence level of the surface defect detection model does not meet the preset confidence level. When the model confidence level on the validation set is lower than the pass standard, the threshold is increased by a fixed step size, and the training and validation process is re-executed. If the confidence level is still not passable after the increase, it is increased again until the confidence level is passable. If the confidence level shows a downward trend after adjustment, the adjustment direction is switched, the threshold is reduced by a fixed step size, and the training and validation process continues. Through this linear step size adjustment method, regions that were incorrectly excluded or incorrectly included due to improper threshold settings are corrected, the quality of the regenerated training samples is optimized, and the boundary between defects and background can be learned more accurately in the next round of training. Ultimately, the confidence level on the validation set gradually rises back to the pass standard, thereby improving the detection performance.

[0066] In a preferred embodiment of the present invention, the fixed step size is 5. If the value is too large, the single adjustment step size will be too large, which will easily cause the model performance to oscillate between high and low. If the value is too small, multiple adjustments are required to return to the ideal range, which will prolong the model tuning cycle. The specified value can ensure that in most cases a single adjustment can raise the confidence level back to above the qualified line, while avoiding oscillations or inefficiencies caused by improper step size.

[0067] Specifically, the adjusted preset grayscale threshold should not be lower than 160 and not higher than 200.

[0068] In this embodiment of the invention, after adjusting the preset grayscale threshold, all images are re-judged for defects, and the training set and validation set are re-divided. The model is trained again, and the training set and validation set are randomly divided again according to a 7:3 ratio. The model training and validation set confidence statistics are completed again. The threshold adjustment and model validation process is repeated until the model confidence meets the 0.97 pass standard, and then it is put into actual detection.

[0069] The technical solution of the present invention has been described above with reference to the preferred embodiments shown in the accompanying drawings. However, it will be readily understood by those skilled in the art that the scope of protection of the present invention is obviously not limited to these specific embodiments. Without departing from the principles of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will all fall within the scope of protection of the present invention.

Claims

1. A method for detecting surface defects in a folding table based on machine learning, characterized in that, include: Acquire surface images of several folding tables, and preprocess these surface images to obtain smooth images; Several candidate defect sub-regions are determined based on the gray-level feature values ​​of several sub-regions of the smooth image and a preset gray-level threshold, and the defect region is determined based on the average curvature change value of the candidate defect sub-regions. The defect type is determined based on the linear extension and undulation dispersion of the skeleton line of the defect region. If the defect cannot be determined as a scratch or dent, a mixed defect is determined based on the morphological heterogeneity of the defect region. Training samples are formed by pairing single surface images with their defect discrimination result labels. Several samples are divided into training set and validation set. The training set is then input into the machine learning model for training to obtain the surface defect detection model. The validation set is input into the surface defect detection model to determine the detection accuracy of the surface defect detection model based on the confidence level.

2. The machine learning-based surface defect detection method for folding tables according to claim 1, characterized in that, The candidate defect sub-region is determined based on a grayscale feature value that is less than a preset grayscale threshold, wherein... The grayscale feature value is the arithmetic mean of the grayscale values ​​of all pixels in a single sub-region.

3. The machine learning-based surface defect detection method for folding tables according to claim 2, characterized in that, The defect region is determined based on the fact that the average curvature change value of the skeleton line of the candidate defect sub-region is greater than or equal to a preset average curvature change value.

4. The machine learning-based surface defect detection method for folding tables according to claim 3, characterized in that, The average curvature change value is determined based on the turning interior angle of an adjacent line segment formed by sequentially selecting three consecutive pixels on the skeleton line.

5. The machine learning-based surface defect detection method for folding tables according to claim 4, characterized in that, The defect types include scratch defects and dent defects, wherein, The scratch-type defects are determined based on the linear extension of the skeleton line being greater than or equal to a first preset linear extension and the undulation dispersion being less than or equal to a first preset undulation dispersion. The depression-type defect is determined based on the linear extension being less than or equal to a second preset linear extension and the undulation dispersion being greater than or equal to a second preset undulation dispersion.

6. The machine learning-based surface defect detection method for folding tables according to claim 5, characterized in that, The linear elongation is the ratio of the extension length of the skeleton line of the defect area to the average width in the vertical direction of the extension length, which is used to distinguish between the long strip structure of scratches and the block-like structure of depressions without elongation.

7. The machine learning-based surface defect detection method for folding tables according to claim 6, characterized in that, The undulation dispersion is the gray-level variance of the defect area, used to distinguish between smooth and uneven gray-level distributions on scratched surfaces.

8. The machine learning-based surface defect detection method for folding tables according to claim 7, characterized in that, The defect types also include hybrid defects, wherein, The hybrid defects are determined based on the morphological heterogeneity being greater than or equal to a preset morphological heterogeneity.

9. The machine learning-based surface defect detection method for folding tables according to claim 8, characterized in that, The morphological heterogeneity is determined based on the absolute value of the difference in grayscale variance between sub-blocks within the defective region, and is used to measure the degree of spatial heterogeneity of the defective region.

10. The machine learning-based surface defect detection method for folding tables according to claim 9, characterized in that, The detection accuracy of the surface defect detection model is unqualified, and the confidence level output by the current surface defect detection model is less than the preset confidence level; and the preset grayscale threshold is adjusted based on the current confidence level.

Citation Information

Patent Citations

  • Furniture surface quality inspection method based on machine vision

    CN118823029B