A quality inspection method for plastic lace
By employing image preprocessing and machine learning techniques, the challenge of extracting the shape and size features of heat deformation defects in plastic lace was solved, enabling automated defect identification and quality assessment, and improving the accuracy and efficiency of detection.
Patent Information
- Application Number
- CN202411893970.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2044-12-20
AI Technical Summary
Extracting the shape and size characteristics of heat deformation defects in plastic lace is difficult, and existing technologies cannot accurately identify and measure them, leading to unstable test results.
Image preprocessing techniques are used for noise reduction and enhancement, combined with shape and size feature extraction to construct a comprehensive feature vector, and a machine learning model is used for defect identification and judgment.
This improved the accuracy and efficiency of plastic lace quality inspection, reduced the workload of manual inspection, and increased the product yield.
Smart Images

Figure CN119850534B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of information technology, and particularly relates to a quality inspection method of plastic lace. BACKGROUND
[0002] In the detection of hot deformation defects of plastic lace, there are problems in the extraction of shape features and size features. First, the extraction of shape features needs to accurately quantify the curvature radius and angle of bending defects, the twisting direction and degree of twisting defects, the proportion and direction of shrinkage defects, and the degree of expansion defects. However, due to the complex surface texture and irregular edge contour of plastic lace, the accuracy of feature extraction is insufficient. Second, the measurement of size features needs to accurately obtain the length, width and area information of the defect area. However, the measurement results are unstable due to the influence of image noise, uneven illumination and shadow interference. The two types of features are related to each other. The accurate extraction of shape features depends on the accurate measurement of size features, and the reliable acquisition of size features is subject to the correct recognition of shape features. Therefore, denoising and enhancement need to be performed in the image preprocessing stage to improve the accuracy of edge detection and contour extraction. At the same time, a fusion model of shape features and size features is established to realize the mutual correction and optimization of feature extraction, thereby improving the overall performance of hot deformation defect detection. SUMMARY
[0003] The present application provides a quality inspection method of plastic lace, mainly comprising:
[0004] The image of the hot deformation defect of the plastic lace is acquired, image preprocessing is performed on the image, the preprocessing includes denoising and enhancement, and defect image data is obtained; relevant data of the bending defect, the twisting defect and the shrinkage defect in the defect image data is extracted, a defect area is obtained, shape feature extraction is performed on the relevant data, the extracted shape features are constructed into a feature vector, and a shape feature vector of the hot deformation defect is obtained; geometric size parameters of the defect area are measured, the total area of the defect area is calculated, and the area proportion relative to the entire image is taken as a relative area feature, the geometric size parameters of the defect area are combined into a feature vector, and a size feature vector of the hot deformation defect is obtained; the shape feature vector and the size feature vector of the hot deformation defect are fused to construct a comprehensive feature vector of the hot deformation defect; the comprehensive feature vector of the hot deformation defect is input into a preset hot deformation defect recognition model for training, and learning of preset labeled samples is performed, and a discriminant function between the hot deformation defect type and the comprehensive feature vector is established; the comprehensive feature vector is extracted from the input hot deformation defect image of the plastic lace by using the established discriminant function between the hot deformation defect type and the comprehensive feature vector, the hot deformation defect recognition result is obtained according to an output result, the hot deformation defect recognition result is used to determine the defect type through the discriminant function, and the defect type includes bending, twisting and shrinkage; the bending defect arc radius threshold value, the twisting defect twist angle threshold value and the shrinkage defect shrinkage proportion threshold value corresponding to the defect type are acquired, if the identified defect arc radius is less than the threshold value, the twist angle is greater than the threshold value, and the shrinkage proportion is greater than the threshold value, then it is determined that the quality of the plastic lace is unqualified, otherwise, it is determined that the quality is qualified.
[0005] The technical scheme provided by the embodiment of the application can include the following beneficial effects:
[0006] The application discloses a quality inspection method for plastic lace. The method aims at the common hot deformation defect problem in the production of plastic lace and realizes automatic recognition and quality determination through image processing and machine learning technology. Specifically, the application first preprocesses and extracts features from the defect image, and constructs a comprehensive feature vector containing shape and size information. Then, the pre-trained recognition model is used to identify the defect type and measure the parameters of the input image. Finally, according to the set threshold standard, the product quality is automatically determined to be qualified or not. The technical scheme of the application can effectively improve the quality control efficiency and accuracy of plastic lace production, reduce the workload of manual detection, and has important significance for improving the product yield. BRIEF DESCRIPTION OF DRAWINGS
[0007] Fig. 1 The flowchart of the quality inspection method for plastic lace of the application.
[0008] Fig. 2 The schematic diagram of the quality inspection method for plastic lace of the application.
[0009] Fig. 3 FIG. 7 is another schematic diagram of a quality inspection method of a plastic lace according to the present application. DETAILED DESCRIPTION
[0010] The technical solutions of the present application will be described clearly and completely below in conjunction with the embodiments. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all the other embodiments obtained by those skilled in the art without creative labor are within the protection scope of the present application.
[0011] As Figs. 1-3 the present embodiment, the quality inspection method of the plastic lace can specifically include:
[0012] In step S101, the heat deformation defect image of the plastic lace is acquired, and image preprocessing is performed on the image. The preprocessing includes denoising and enhancement, and the defect image data is obtained.
[0013] For the heat deformation defect original image of the plastic lace, the noise points in the original image are filtered out by median filtering, and the filtered image is processed by a bilateral filter to obtain a second image. According to the second image, a block adaptive histogram equalization operation is performed, and a nonlinear mapping transformation is performed based on the local region brightness feature of the image to obtain a third image. For the third image, a Canny edge detection operator is used to extract the heat deformation defect edge profile, the edge profile is processed by morphological opening operation, and the processed edge is segmented by gray threshold to obtain a fourth image. For the defect profile region segmented in the fourth image, the defect profile region is marked. If the connected domain area of the defect profile region is greater than an area threshold and the gray mean value reaches a preset gray mean value, the defect profile region is determined as a target defect.
[0014] Specifically, the image acquisition device collects the hot deformation defect image of the plastic lace, the original image is filtered to remove salt and pepper noise points through 3x3 template size median filtering, and a 5x5 window size bilateral filter is used for the filtered image to maintain the image edge structure information and filter out Gaussian white noise to obtain a second image. For the second image, an adaptive histogram equalization operation is performed with an 8x8 block size, the local cumulative histogram of the gray value in each block image is calculated, and the image contrast is enhanced through nonlinear mapping transformation based on the local area brightness feature of the image to obtain a third image. The edge profile of the hot deformation defect is extracted using the Canny edge detection operator for the third image, morphological opening operation is performed according to the 3x3 circular structural element to remove small edge interference points, and the image segmentation threshold is set to 125 for the edge image to remove background interference and segment the defect edge to obtain a fourth image. For the defect profile region segmented in the fourth image, the defect region is labeled by 8-neighborhood labeling method, and the connected domain area greater than 100 pixels is selected according to the connected domain area. The defect region is binarized according to the defect gray mean value of 250 to obtain the defect image data. The defects generated in the hot deformation process of the plastic lace mainly manifest as physical morphological changes such as fracture, wrinkle and deformation, and these defects show obvious differences in gray value with normal regions in the image. When the original image is collected, due to uneven environmental light and sensor noise interference, the image may be mixed with salt and pepper noise and Gaussian noise. Salt and pepper noise is manifested as randomly distributed black and white pixel points, and the median value in the neighborhood of each pixel point is replaced by a 3x3 median filtering window, effectively removing such sudden noise points. Gaussian noise is manifested as random fluctuations in pixel values, and a 5x5 bilateral filter is used to maintain edge jumps while smoothing noise. In image enhancement, 8x8 block adaptive histogram equalization is used to calculate the cumulative histogram for each block. If the maximum gray value in a block is 200, the minimum gray value is 50, the total number of pixel points in the block is 64, and the cumulative number of pixel points with a gray value of 125 is 32, then the new value after mapping of this gray value is 125. This local adaptive enhancement method avoids the over-enhancement problem caused by global histogram equalization. The Canny operator is used for hot deformation defect edge feature extraction, and the edge pixel point position is determined by calculating the image gradient amplitude and direction. The defect region edge often presents an irregular shape, and a 3x3 circular structural element is used for morphological opening operation to remove small noise points while maintaining the main edge structure. The image segmentation threshold is set to 125, and the background region pixel points below the threshold are set to 0 to retain the defect edge profile information. The segmented defect region is labeled by 8-neighborhood connected domain labeling, and the connectivity of each pixel point with its surrounding 8 pixel points is judged. If the connected domain area of a certain defect region is less than 100 pixels, it is considered to be noise interference and is removed. The defect region often presents a higher gray value feature, and the gray threshold is set to 250 for binarization processing. The region above the threshold is determined as the defect region.In practical applications, the area of the hot deformation defect of the plastic lace is generally between 200 and 800 pixels, and the gray value is concentrated between 230 and 255, which can be used as an important basis for defect detection.
[0015] In step S102, the related data of the bending defect, the twisting defect and the shrinkage defect in the defect image data is extracted to obtain a defect region, and the shape feature of the related data is extracted to construct a feature vector, and the shape feature vector of the hot deformation defect is obtained.
[0016] The connected domain area of the edge contour of the defect region is calculated, the Hough circle transformation is used for the edge contour curve, the bending radius and the bending angle of the bending defect region are obtained, the shape feature is extracted from the contour curve coordinate sequence, and a second image is obtained; for the mark region in the second image, the principal axis direction of the region is calculated by using the image inertia moment; if the gray value of the mark region presents periodic change in the principal axis direction, it is determined as a twisting defect region; the included angle between the principal axis direction of the twisting defect region and the horizontal direction is obtained to obtain a twisting angle; the twisting degree is calculated according to the fluctuation amplitude of the gray value of the twisting defect region in the principal axis direction; the shape feature of the contour of the twisting defect region is extracted to obtain a third image; the mark region is extracted from the third image, the region centroid coordinates are calculated, and the shrinkage center point position is obtained; the shrinkage direction is determined by the distance change of the boundary point of the extracted mark region to the centroid; the shrinkage ratio is calculated by using the ratio of the area of the region after shrinkage to the initial area of the region; the shape feature of the shrinkage defect is extracted according to the curvature change of the contour point of the extracted mark region to obtain a fourth image; for the shape feature extracted from the fourth image, the minimum maximum value normalization method is used to process the bending defect feature, the twisting defect feature and the shrinkage defect feature data respectively, the hot deformation defect shape feature vector is constructed according to the feature correlation weight, and the shape feature vector of the hot deformation defect is obtained.
[0017] Specifically, after the defect edge contour is extracted from the defect region of the image segmentation by using the Canny edge detection operator, the connected domain area is calculated by using the 8-neighborhood marking method for the edge contour, the bending radius and the bending angle of the bending defect region are calculated by using the Hough circle transformation for the contour curve, and the arc length value is obtained by using the curve arc length calculation formula, and the shape feature is extracted from the contour curve coordinate sequence to obtain a second image. Wherein
[0018]
[0019] , wherein dy / dx is the derivative of the curve, representing the slope of the curve at any point. For the marked region in the second image, the principal axis direction of the region is calculated using the image moment of inertia. If the gray value of the region shows periodic changes in the principal axis direction, it is determined as a twisted defect region. The twist angle is obtained by the angle between the principal axis direction and the horizontal direction, and the twist degree is calculated according to the fluctuation amplitude of the gray value of the region in the principal axis direction. The shape feature of the twisted defect contour is extracted to obtain the third image. The center point position of the shrinkage is obtained by extracting the marked region from the third image and calculating the centroid coordinates of the region. The shrinkage direction is determined by the distance change of the region boundary point to the centroid. The shrinkage ratio is calculated by using the ratio of the area of the region after shrinkage to the initial area of the region. The shrinkage defect shape feature is extracted according to the curvature change of the region contour point to obtain the fourth image. The shrinkage ratio is calculated by the following formula:
[0020]
[0021] , A final represents the area of the region after shrinkage, A initial represents the initial area of the region. For the shape features extracted in the fourth image, the minimum maximum value normalization is used to process the bending defect feature, the twisted defect feature, and the shrinkage defect feature data. The weights of the normalized bending defect feature, the twisted defect feature, and the shrinkage defect feature are calculated respectively. The shape feature vector of the thermal deformation defect is obtained according to the correlation weight of the features to obtain the shape feature vector of the thermal deformation defect.
[0022]
[0023] , w bend represents the weight of the bending defect feature, M represents the number of samples, y i represents the label of the i-th sample, x i , bend represents the bending defect feature value of the i-th sample.
[0024]
[0025] , w twist represents the weight of the twisted defect feature, M represents the number of samples, y i represents the label of the i-th sample, x i , twist represents the twisted defect feature value of the i-th sample.
[0026]
[0027] , w shrink represents the weight of the shrinkage defect feature, M represents the number of samples, y i represents the label of the i-th sample, x i, shrink represents the shrinkage defect feature value of the i-th sample. The bending, twisting and shrinkage defects in the hot deformation defects of plastic lace have unique shape characteristics. The bending defect shows that the local lace occurs arc deformation, and the contour extracted by Canny edge detection shows obvious arc characteristics. The arc radius and angle can be calculated by Hough circle transformation. When the lace bends 90 degrees, the arc radius is usually between 5 to 15 mm, and the arc length accounts for 15% to 25% of the entire contour length. These characteristic values constitute the quantitative indexes of bending defects. The twisting defect is manifested as a periodic change in the gray value in the image. The principal axis direction is obtained by calculating the inertia moment of the image. In actual cases, when the plastic lace twists 45 degrees, the gray value along the principal axis direction shows a fluctuation of 4 to 6 cycles, and the fluctuation amplitude is between 50 to 80 gray levels. The degree of twisting is determined by the frequency and amplitude of the gray fluctuation. The higher the frequency and the greater the amplitude, the more serious the twisting. The shrinkage defect is described by the area change and the degree of shape distortion. The center of mass of the defect area is calculated as the shrinkage center point. The standard deviation of the distance between the boundary points of the normal plastic lace and the center of mass is within the range of 2 to 3 mm, while the value increases to 4 to 6 mm after shrinkage. The shrinkage ratio is calculated by the area ratio. The area ratio of slight shrinkage is between 0.85 to 0.95, and the severe shrinkage is reduced to below 0.7. The three defect features are fused to form a feature vector after normalization. Taking a plastic lace sample as an example, the bending defect features include an arc radius of 12 mm, an arc angle of 75 degrees, and an arc length of 18 mm; the twisting defect features include a twisting angle of 35 degrees, a fluctuation frequency of 5 cycles, and a gray fluctuation amplitude of 65; the shrinkage defect features include a shrinkage ratio of 0.82 and a boundary point distance standard deviation of 4.8 mm. These feature values are mapped to the interval of 0 to 1 by minimum maximum value normalization, and then the feature weights are calculated according to the linear discriminant function to construct a comprehensive feature vector reflecting the degree of hot deformation.
[0028]
[0029] , v represents the comprehensive feature vector, w i represents the weight of the i-th feature, x i represents the i-th feature vector, and N represents the number of features. In the feature extraction process, the edge detection threshold, the principal axis direction calculation, and the area statistics parameter setting directly affect the accuracy of the feature value. Practice shows that the low threshold of the Canny operator is set to 50 and the high threshold is set to 150, which can effectively extract the edge contour of the plastic lace. The inertia moment of the image is calculated using a 9x9 neighborhood window, which can accurately obtain the principal axis direction of the twisted area. When calculating the shrinkage center point, a 3x3 Gaussian weight is used to smooth the region centroid coordinates, improving the stability of the center point position.
[0030] In step S103, the geometric size parameters of the defect area are measured, the total area of the defect area is calculated, and the area proportion relative to the entire image is taken as a relative area feature. The geometric size parameters of the defect area are combined into a feature vector to obtain a size feature vector of the heat deformation defect.
[0031] An edge contour point set is obtained by using a Sobel operator for the defect area. A projection length and a width are calculated according to the edge contour point set. An actual contour length is calculated by calculating a contour point distance cumulative value. An actual width is obtained by the perpendicular distance between the contour point set and a projection axis. The number of pixel points occupied by the defect area is extracted. A relative area proportion is calculated by the ratio of the number of pixel points to the total number of pixel points of the image. Mean filtering is used to remove measurement data outliers. The length, width and area values of the defect area are processed by minimum-maximum value normalization. Feature weights are calculated by the Pearson correlation coefficients of the length, width and area values of the defect area to obtain a size feature vector of the heat deformation defect.
[0032] Specifically, the defect edge contour point set is obtained by the Sobel edge detection operator from the defect area obtained by image segmentation, the projection length and width of the defect area in the horizontal and vertical directions are calculated by the minimum circumscribed rectangle for the edge contour point set, the defect area is calculated by counting all pixel points in the edge contour point set and multiplying the actual area of a single pixel, and the fifth image is obtained by recording the coordinates of the defect edge contour point set. For the defect edge point set recorded in the fifth image, the actual contour length of the defect area is obtained by calculating the cumulative value of the distance between adjacent contour points by using the four-neighbor point tracking algorithm, the actual length value is calculated by the conversion ratio of the pixel to the actual size through pre-calibration, and the actual width of the defect area is obtained by the vertical distance between the contour point set and the projection axis to obtain the sixth image. The defect area data is extracted from the sixth image, the relative area ratio is calculated by the ratio of the number of pixel points occupied by the defect area to the total number of pixel points in the image, the actual area is calibrated according to the lens parameters and working distance of the image acquisition device, and the seventh image is obtained based on the mean filter to remove measurement data outliers. For the geometric size features extracted in the seventh image, the minimum maximum value normalization is used to process the length, width, area and relative area values of the defect area, the feature weight is calculated according to the Pearson correlation coefficient of the feature data, and the thermal deformation defect feature data is obtained by constructing a thermal deformation defect size feature vector through serial combination. The size measurement of the plastic lace thermal deformation defect area needs to be analyzed from multiple dimensions such as edge contour, geometric size and area characteristics. Sobel edge detection obtains edge contour points by calculating the gray difference in the horizontal and vertical directions of the image. For the thermal deformation defect image, the horizontal operator kernel size is 3x3, the vertical operator kernel size is 3x3, and the edge point is determined when the image edge gray jump exceeds the threshold value 125. For a typical lace thermal deformation defect, the minimum circumscribed rectangle reflects the overall size range of the defect area. In actual measurement, in a 1000x1000 pixel image, the width of the normal plastic lace is about 200 pixels, and the minimum circumscribed rectangle width of the defect area after thermal deformation increases to 250 to 300 pixels. Through the pre-calibrated pixel size ratio 0.05mm / pixel, the actual defect area width can be converted to 12.5 to 15mm. When calculating the actual length of the defect contour, the point with the maximum gray value is selected as the starting point from the edge point set, and the adjacent edge points are searched in the order of up, right, down and left. For a typical arc-shaped thermal deformation defect, the total length of the contour is about 400 to 600 pixels, and the actual length is between 20 and 30mm. The actual width of the defect area is determined by the maximum vertical distance of the contour point to the horizontal projection axis, which is generally between 8 and 12mm. The defect area calculation is based on pixel counting, and an intermediate thermal deformation defect area occupies 40000 to 60000 pixel points. In a 1000x1000 image, the relative area ratio is between 4% and 6%.When the camera lens focal length is set to 50 mm and the working distance is kept at 300 mm, the actual area corresponding to a single pixel is 0.0025 mm2, and thus the actual area of the defect region is calculated to be between 100 and 150 mm2. The geometric size feature normalization processing adopts the minimum-maximum value method. Taking the defect length as an example, if the maximum length in the sample data is 30 mm and the minimum length is 15 mm, and the measured length of a certain defect is 20 mm, then the normalized value is 0.33. The feature weight calculation shows that in the hot deformation defect recognition, the correlation coefficient of the relative area feature and the defect length reaches 0.85, indicating that the two have strong correlation, while the correlation coefficient of the width feature is lower, only 0.45. In the finally constructed feature vector, the relative area and length features obtain higher weights, which are 0.4 and 0.35 respectively, while the width feature weight is 0.25.
[0033] Step S104, fusing the shape feature vector and the size feature vector of the hot deformation defect to construct a comprehensive feature vector of the hot deformation defect.
[0034] Obtaining a shape feature vector and a size feature vector in a defect image, performing Z-score standardization processing on the shape feature vector and the size feature vector, and removing abnormal data to obtain a second feature vector by adopting a standard deviation principle; calculating a Pearson correlation coefficient according to a feature value in the second feature vector, reserving a positively correlated feature if the correlation coefficient is a positive value, reserving a negatively correlated feature if the correlation coefficient is a negative value, and distributing weights to the feature values by an absolute value of the correlation coefficient to obtain a third feature vector; performing weighted average calculation on the feature values to which the weights have been distributed in the third feature vector, and performing numerical mapping on the weighted sum result by adopting maximum-minimum value normalization to obtain a fourth feature vector; performing principal component analysis on the normalized feature values in the fourth feature vector, screening the number of principal components by a cumulative contribution rate threshold, and constructing a comprehensive feature vector according to a principal component score to obtain a comprehensive feature vector of the hot deformation defect.
[0035] Specifically, according to the shape feature vector and the size feature vector extracted from the defect image, the feature values in each dimension are standardized by Z-score, and the abnormal data are removed according to the 3 times standard deviation principle. The second feature vector is obtained by aligning the data of the shape feature vector and the size feature vector after removing the abnormal values. According to the feature values in the second feature vector, the correlation between the shape feature and the size feature is calculated by the Pearson correlation coefficient. If the correlation coefficient is positive, the two features are positively correlated and reserved. If the correlation coefficient is negative, the two features are negatively correlated and reserved. The feature values are weighted and distributed according to the absolute value of the correlation coefficient to obtain the third feature vector. The shape feature values and size feature values with assigned weights are extracted from the third feature vector, and the fusion feature values are calculated by weighted average. The fusion feature values are weighted and summed according to the calculated weight values, and the weighted sum result is mapped to the numerical range by maximum and minimum value normalization to obtain the fourth feature vector. According to the normalized feature values in the fourth feature vector, the feature values are reduced by principal component analysis, and the number of principal components is selected by the cumulative contribution rate threshold of 0.95. The comprehensive feature vector is constructed according to the principal component score to obtain the hot deformation defect feature data. The distribution characteristics and correlation of the feature data need to be considered in the fusion process of the shape feature vector and the size feature vector of the hot deformation defect. Z-score standardization converts the original feature data into a standard normal distribution with a mean of 0 and a standard deviation of 1, making features with different dimensions comparable. Taking the radius of curvature in the shape feature vector as an example, the original value is distributed between 10 and 30 mm, and the standardized value is distributed between -2 and 2. For the determination of abnormal values, if the Z-score of a measurement value exceeds 3 or is less than -3, it is considered as abnormal data and is removed. The correlation analysis between features reflects the internal relationship between shape features and size features. In actual measurement, the radius of curvature of the bending defect is significantly positively correlated with the area of the defect region, with a correlation coefficient of 0.82, indicating that the larger the radius of curvature, the larger the defect area. While the twist angle and the width of the defect region are negatively correlated, with a correlation coefficient of -0.65, indicating that the larger the twist angle, the smaller the width of the defect region. The sign of the correlation coefficient determines the direction of weight distribution in feature fusion. Feature fusion uses the weighted average method, and the weight value is proportional to the absolute value of the correlation coefficient. For the radius of curvature feature with a correlation coefficient of 0.82, the weight is assigned as 0.35; for the area feature with a correlation coefficient of 0.75, the weight is assigned as 0.32; for the twist angle feature with a correlation coefficient of 0.65, the weight is assigned as 0.28; and for the remaining features, the weight is assigned as 0.05. The fusion feature values after weighted sum are mapped to the interval of 0 to 1 by maximum and minimum value normalization. The normalized fusion features are reduced by principal component analysis, and the principal components with a cumulative contribution rate of 95% are retained. In practical applications, the contribution rates of the first three principal components are 65%, 20%, and 10%, respectively, and the cumulative contribution rate reaches 95%, so these three principal components are selected to construct the final comprehensive feature vector.The first principal component mainly reflects the overall size characteristics of the defects, the second principal component reflects the shape deformation characteristics, and the third principal component reflects the local detail characteristics. This dimension reduction processing not only retains the key feature information, but also reduces the data redundancy. In the feature fusion process, the features of different types of defects are different. The size characteristics are dominant for the bending defects, and the shape characteristics are auxiliary; the shape characteristics are dominant for the twisting defects, and the weight of the shape characteristics is higher; and the shape characteristics and size characteristics of the shrinkage defects have similar weights. Through feature fusion and dimension reduction, the comprehensive feature vector obtained can comprehensively reflect various aspects of the hot deformation defects, and provide reliable feature data for subsequent defect recognition.
[0036] In step S105, the comprehensive feature vector of the hot deformation defect is input into a preset hot deformation defect recognition model for training, and the preset labeled samples are learned to establish a discrimination function between the hot deformation defect type and the comprehensive feature vector.
[0037] According to the hot deformation defect comprehensive feature vector, a training sample set is obtained through undersampling processing, the number of bending defect samples, twisting defect samples and shrinkage defect samples in the training sample set is balanced, a label matrix is constructed for the training sample set; a nonlinear classifier is constructed by using a support vector machine for the label matrix, optimal parameter combinations are obtained by optimizing radial basis kernel function parameters and penalty coefficients through a grid search method; the optimal parameter combinations are used to construct a discrimination function, support vectors are iteratively calculated by a sequential minimal optimization algorithm, discrimination function coefficients are obtained according to a maximum interval principle; the discrimination function values are calculated for the discrimination function coefficients, if the discrimination function value is greater than a discrimination threshold, it is determined as a first type of defect, if the discrimination function value is less than the discrimination threshold, it is determined as a second type of defect, and a hot deformation defect discrimination function is obtained by recording the defect recognition results through a confusion matrix.
[0038] Specifically, according to the thermal deformation defect comprehensive feature vector and the preset labeled sample, the number of bending defect samples, twisting defect samples and shrinkage defect samples is balanced through undersampling processing, the training sample set and the verification sample set are divided according to the proportion of 8:2, the label matrix is constructed according to the defect label category information, the fifth feature vector is obtained by dividing the training subset through 5-fold cross-validation. According to the fifth feature vector and the corresponding label data, a nonlinear classifier is constructed through support vector machine, the parameter optimization is carried out through grid search method according to the radial basis kernel function parameter range of 0.1 to 10 and the penalty coefficient range of 1 to 100, the optimal parameter combination is selected by calculating the classification accuracy rate in the verification subset. The discriminant function is constructed from the optimal parameter combination, the support vector is calculated through the iterative calculation of the sequential minimal optimization algorithm, the discriminant function coefficient is obtained according to the principle of maximum interval, and the iteration termination condition is set as the function value convergence less than 0.001 or the iteration number reaching 1000 times to obtain the sixth feature vector. According to the sixth feature vector and the verification sample set, the discriminant function value of each defect sample is calculated, the samples are classified through the discriminant threshold 0, the classification accuracy, precision and recall rate are calculated according to the predicted category and the real category, and the thermal deformation defect discriminant function is obtained by recording the recognition results of each type of defect through the confusion matrix. In the labeled sample of thermal deformation defect, the number of different types of defects often exists imbalance phenomenon. Taking 1000 samples collected in actual production as an example, there are 500 bending defects, 300 twisting defects and only 200 shrinkage defects. Through undersampling to keep the sample balanced, 200 samples are randomly selected from the bending defects and the twisting defects, so that the number of three types of defect samples is 200. In the 600 balanced samples, 480 training samples and 120 verification samples are obtained according to the proportion of 8:2. The core of support vector machine is to map the features to high-dimensional space through kernel function. The parameter γ of radial basis kernel function determines the complexity of mapping space, the larger the γ value, the more complex the decision boundary. Grid search sets 10 value points from 0.1 to 10, and searches 10 value points of penalty coefficient C from 1 to 100. In the actual optimization process, when γ takes 0.5 and C takes 10, the verification set accuracy reaches the highest value of 92%. The sequential minimal optimization algorithm solves the support vector by iteratively updating the Lagrange multiplier. In the classification of thermal deformation defects, the support vectors are often distributed in the boundary region of different types of defects. For example, at the boundary between bending defects and twisting defects, samples with an arc radius close to 45 degrees and a slight twisting feature are easy to become support vectors. In the algorithm iteration process, the calculation is stopped when the difference between the objective function values of two consecutive iterations is less than 0.001 or the iteration number exceeds 1000 times. The discriminant function directly reflects the defect category to which the sample belongs in practical application. For a test sample, if its discriminant function value is greater than 0, it is classified as positive class, that is, the defect of this type, otherwise it is classified as negative class, that is, other types of defects.The test on the verification sample set shows that the recognition accuracy of the bending defect is 94%, the recall rate is 91%, the accuracy of the distortion defect is 89%, the recall rate is 87%, and the accuracy of the shrinkage defect is 90%, the recall rate is 88%. The confusion matrix further shows that the misjudgment rate between the bending defect and the shrinkage defect is the lowest, which is 3%, while the misjudgment rate between the distortion defect and the bending defect is higher, which is 8%, because there is overlap between the two types of defects in some features. In the whole process of model training and verification, 5-fold cross-validation provides stable performance evaluation. In each fold verification, the model is trained on different training subsets and verified on the remaining subsets, and the average performance is taken as the evaluation result. This verification method effectively avoids overfitting, so that the discriminant function obtained by training has good generalization ability.
[0039] In step S106, the established discriminant function between the heat deformation defect type and the comprehensive feature vector is used to extract the comprehensive feature vector of the input plastic lace heat deformation defect image, and the heat deformation defect recognition result is obtained according to the output result. The heat deformation defect recognition result is used to determine the defect type through the discriminant function, and the defect type includes bending, distortion and shrinkage.
[0040] For the shape feature vector and the size feature vector, the feature dimension corresponding to the cumulative contribution rate is obtained by principal component analysis, and the comprehensive feature vector is constructed by series combination. The data normalization is performed on the comprehensive feature vector; according to the data normalized comprehensive feature vector, the sample to classification hyperplane distance is calculated by using the preset radial basis kernel function parameter and the penalty coefficient, and after the conversion by the sigmoid function, the defect type probability value is obtained, the discriminant value is calculated by the Broomman multi-class discriminant function, if the discriminant value exceeds the preset discriminant threshold, it is classified as the current defect type; for the calculated discriminant value, the maximum probability criterion is used to select the defect type, if the discriminant result exceeds the preset confidence threshold, the heat deformation defect type is determined.
[0041] Specifically, according to the shape feature vector and the size feature vector extracted from the hot deformation defect image, the feature dimensions with a cumulative contribution rate of 95% are reserved through principal component analysis, the feature data after dimension reduction is combined in series to construct a comprehensive feature vector, and the seventh feature vector is obtained by normalizing the combined feature vector. According to the normalized feature data in the seventh feature vector, the distance of the sample to the classification hyperplane is calculated through the radial basis kernel function parameter 0.5 and the penalty coefficient 10 in the pre-trained support vector machine, the probability distribution of the defect type is obtained by converting the distance value through the sigmoid function, and the eighth feature vector is obtained. The defect type probability value is extracted from the eighth feature vector, the discrimination values of each type of defect are calculated through the Bingham multi-class discrimination function, the defect type is classified according to the preset discrimination threshold 0.5, and if the discrimination value exceeds the threshold, it is classified as the current defect type to obtain the ninth feature vector. According to the discrimination value in the ninth feature vector, the maximum probability criterion is used to select the type with the maximum probability value from the bending defect, the twisting defect and the shrinkage defect, and the recognition result is filtered through the confidence threshold 0.8, and the hot deformation defect type is determined according to the discrimination result to obtain the hot deformation defect recognition result. The hot deformation defect image forms a high-dimensional feature vector after feature extraction, which includes two categories of shape features and size features. The shape features include 10 feature dimensions such as radius of curvature, twisting angle and shrinkage ratio, and the size features include 8 feature dimensions such as length, width and area. Principal component analysis is used to reduce the dimension of the 18-dimensional features, the first principal component has a contribution rate of 65%, reflecting the overall size information of the defect, the second principal component has a contribution rate of 20%, representing the shape deformation degree, and the third principal component has a contribution rate of 10%, representing the local detail features. Retaining these three principal components can cover 95% of the information. The pre-trained support vector machine uses a radial basis kernel function for feature mapping, and the kernel function parameter γ is 0.5, which has moderate feature mapping capability. In practical application, for a bending defect sample, the distance to the classification hyperplane is 2.5, and the probability value obtained by converting through the sigmoid function is 0.92, indicating that the sample has a 92% probability of belonging to the bending defect type. In contrast, the probability of the same sample corresponding to the twisting defect is only 0.05, and the probability corresponding to the shrinkage defect is 0.03. The Bingham multi-class discrimination function realizes multi-class discrimination by constructing an inter-class distance matrix. In actual classification, if the discrimination value of a certain bending defect sample is 0.85, which is higher than the preset threshold 0.5, it will be classified as a bending defect. At the same time, the discrimination value of the sample corresponding to the twisting defect is 0.3, and the discrimination value of the sample corresponding to the shrinkage defect is 0.2, which are all less than the discrimination threshold, further verifying the reliability of the classification result. The final defect type determination adopts the maximum probability criterion, and sets the confidence threshold to 0.8 to ensure the reliability of the recognition result. Taking a sample as an example, the probabilities of the three defect types corresponding to the sample are bending defect 0.95, twisting defect 0.03 and shrinkage defect 0.02.The bending defect probability is the largest and exceeds the confidence threshold 0.8, so the sample is determined as a bending defect. For a sample with a probability distribution of: bending defect 0.45, twisting defect 0.35, and shrinkage defect 0.20, although the bending defect probability is the largest, it does not exceed the confidence threshold, so further judgment needs to be made in combination with other feature information. In the hot deformation defect recognition process, the features of different types of defects are different. Typical bending defects show obvious arc trajectories in the principal component space, twisting defects show spiral feature distribution, and shrinkage defects have centripetal feature aggregation. These features are fully reflected in the discriminant function, thereby achieving accurate defect type recognition.
[0042] In step S107, the bending defect arc radius threshold value, the twisting defect twist angle threshold value, and the shrinkage defect shrinkage ratio threshold value corresponding to the defect type are obtained. If the identified defect arc radius is less than the threshold value, the twist angle is greater than the threshold value, and the shrinkage ratio is greater than the threshold value, the plastic lace quality is determined to be unqualified, otherwise the quality is determined to be qualified.
[0043] The bending defect arc radius value, the twisting defect twist angle value, and the shrinkage defect shrinkage ratio value in the plastic lace sample are obtained. The mean and standard deviation of the three types of defect features are obtained by statistical analysis of qualified samples. The standardized feature values are obtained by standardization processing according to the mean and standard deviation of the defect features. The threshold interval boundary is determined by adding and subtracting the standard deviation threshold value to the mean for the standardized feature values, to obtain the upper limit of the arc radius threshold value, the lower limit of the twist angle threshold value, and the lower limit of the shrinkage ratio threshold value. If the arc radius value is less than the upper limit of the arc radius threshold value, the twist angle value is greater than the lower limit of the twist angle threshold value, and the shrinkage ratio value is greater than the lower limit of the shrinkage ratio threshold value, the plastic lace quality is determined to be unqualified, and the binary processing is used to output the quality determination mark.
[0044] Specifically, according to the identified heat deformation defect type, the bending defect arc radius value, the twisting defect twist angle value, and the shrinkage defect shrinkage ratio value are extracted, the mean value and the standard deviation of the three types of defect characteristics are obtained through qualified sample statistics, the standardized characteristic value is obtained by subtracting the mean value from the defect characteristic value and dividing by the standard deviation. For the standardized characteristic value, the upper limit of the arc radius threshold, the lower limit of the twist angle threshold, and the lower limit of the shrinkage ratio threshold are calculated according to the 3 times standard deviation principle, the threshold interval boundary is determined by adding and subtracting 3 times the standard deviation, and the threshold range of each type of defect characteristic is recorded; the three types of defect threshold values are extracted, the defect degree is judged by comparing the characteristic value with the threshold value, if the arc radius value is less than the upper limit of the arc radius threshold and the twist angle value is greater than the lower limit of the twist angle threshold and the shrinkage ratio value is greater than the lower limit of the shrinkage ratio threshold, the quality of the plastic lace is determined to be unqualified; based on the determination result, a binary processing output quality judgment mark is adopted, the mark value 0 represents quality qualified, the mark value 1 represents quality unqualified, the quality grade of the plastic lace is determined according to the mark value to obtain the heat deformation defect quality judgment result. The quality judgment of the heat deformation defect of the plastic lace needs to consider multiple physical characteristic parameters. The bending defect arc radius in the qualified sample is usually between 15 mm and 25 mm, the mean value is 20 mm, and the standard deviation is 1.7 mm. The twist angle of the twist defect is distributed between 20 degrees and 40 degrees, the mean value is 30 degrees, and the standard deviation is 3.3 degrees. The shrinkage ratio of the shrinkage defect is between 0.85 and 0.95, the mean value is 0.9, and the standard deviation is 0.017. Standardization processing converts these physical quantities to the same numerical scale. Taking the arc radius as an example, the radius value of a certain sample is 16 mm, subtracting the mean value 20 mm and dividing by the standard deviation 1.7 mm, the standardized value is -2.35. Similarly, the standardized value of the twist angle 35 degrees is 1.52, and the standardized value of the shrinkage ratio 0.87 is -1.76. The standardized value is convenient for unified comparison and threshold setting. Based on the 3 times standard deviation principle, the threshold interval is set, the qualified lower limit of the arc radius is 15 mm, that is, the mean value minus 3 times the standard deviation; the qualified upper limit of the twist angle is 40 degrees, that is, the mean value plus 3 times the standard deviation; the qualified upper limit of the shrinkage ratio is 0.95, that is, the mean value plus 3 times the standard deviation. Samples exceeding these threshold ranges are considered to be unqualified. In the actual judgment process, different types of defects often exist at the same time. Taking a typical sample as an example, the arc radius is 14 mm, which is less than the threshold 15 mm; the twist angle is 42 degrees, which is greater than the threshold 40 degrees; the shrinkage ratio is 0.96, which is greater than the threshold 0.95. The three parameters simultaneously exceed the qualified range, the system determines it to be unqualified, and outputs the identification value 1. While the arc radius of another sample is 18 mm, the twist angle is 35 degrees, and the shrinkage ratio is 0.92, the three parameters are within the qualified range, the system outputs the identification value 0, indicating that the quality is qualified. The binary processing of the quality judgment result simplifies the subsequent processing process. On the production line, the identification value 0 directly triggers the pass signal, and the identification value 1 triggers the alarm signal.The determination mechanism considers the combined effect of multiple defect features, avoiding the one-sidedness that may be caused by single feature determination. For example, some samples may slightly exceed the standard in an individual parameter, but other parameters perform well, and the samples can still be determined as qualified. The comprehensive determination method meets the quality control requirements in actual production.
[0045] The above only lists some preferred embodiments of the present application, but the present application is not limited thereto, and many improvements and changes can be made. As long as the improvements and changes are made on the basis of the basic principles of the present application, they should be considered to fall within the protection scope of the present application.
Claims
1. A method for inspecting a plastic lace, characterized by, The method includes: Images of heat deformation defects in plastic lace are acquired. Image preprocessing, including denoising and enhancement, yields defect image data. Relevant data on bending, twisting, and shrinkage defects are extracted from the defect image data to identify the defect region. Shape features are extracted from the relevant data, and feature vectors are constructed from the extracted shape features to obtain the shape feature vector of the heat deformation defect. Geometric dimensions of the defect region are measured, and the total area of the defect region and its area ratio relative to the entire image are calculated as relative area features. The geometric dimensions of the defect region are combined into a feature vector to obtain the size feature vector of the heat deformation defect. This includes: using the Sobel operator to obtain an edge contour point set for the defect region; calculating the projected length and width based on the edge contour point set; calculating the accumulated distance value of the contour points to obtain the actual contour length; and obtaining the actual width through the perpendicular distance between the edge contour point set and the projection axis. The number of pixels occupied by the defect region is extracted, and the relative area ratio is calculated by the ratio of the number of pixels to the total number of pixels in the image. Mean filtering is used to remove outliers in the measured data. Minimum-maximum normalization is applied to process the defects. The length, width, and area values of the defect region are used to calculate feature weights using the Pearson correlation coefficient of these values, resulting in a size feature vector for the heat deformation defect. The shape and size feature vectors are then fused to construct a comprehensive feature vector. This comprehensive feature vector is input into a pre-defined heat deformation defect recognition model for training, and a discriminant function is established between the heat deformation defect type and the comprehensive feature vector. Using this discriminant function, the comprehensive feature vector is extracted from the input image of the plastic lace heat deformation defect. The heat deformation defect recognition result is obtained based on the output. The defect type is determined using the discriminant function, and the defect types include bending, twisting, and shrinkage. Thresholds are obtained for the radius of curvature of the bending defect, the torsion angle of the twisting defect, and the shrinkage ratio of the shrinkage defect. If the radius of curvature of the identified defect is less than the threshold, the torsion angle is greater than the threshold, and the shrinkage ratio is greater than the threshold, the plastic lace is deemed unqualified; otherwise, it is deemed qualified.
2. The method of claim 1, wherein, The process involves acquiring images of heat deformation defects in plastic lace, followed by image preprocessing, including denoising and enhancement, to obtain defect image data, including: For the original image of the heat deformation defect of plastic lace, noise points in the original image are filtered out by median filtering, and the filtered image is processed by a bilateral filter to obtain a second image. Based on the second image, a block-adaptive histogram equalization operation is performed, and a third image is obtained by nonlinear mapping transformation based on the brightness features of local regions of the image. The Canny edge detection operator is used to extract the edge contour of the thermal deformation defect in the third image. The edge contour is processed by morphological opening operation, and the processed edge is segmented by grayscale thresholding to obtain the fourth image. The defect contour region segmented in the fourth image is marked, and if the connected domain area of the defect contour region is greater than an area threshold and the average gray value reaches a preset average gray value, the defect contour region is determined as a target defect.
3. The method of claim 1, wherein, The related data of the bending defect, the twisting defect and the shrinkage defect in the defect image data is extracted to obtain a defect region, and shape feature extraction is performed on the related data to construct a feature vector from the extracted shape features to obtain a shape feature vector of the thermal deformation defect, including: The connected domain area of the edge contour of the defect region is calculated, Hough circle transformation is performed on the edge contour curve to obtain the radius and angle of the bending defect region, and shape features are extracted from the contour curve coordinate sequence to obtain a second image; For the marked region in the second image, the principal axis direction of the region is calculated using the moment of inertia of the image; If the gray value of the marked region presents periodic variation in the principal axis direction, it is determined as a twisting defect region; The included angle between the principal axis direction of the twisting defect region and the horizontal direction is obtained to obtain a twisting angle; The twisting degree is calculated according to the fluctuation amplitude of the gray value of the twisting defect region in the principal axis direction; The shape features of the contour of the twisting defect region are extracted to obtain a third image; The marked region is extracted from the third image, the region centroid coordinates are calculated, and the shrinkage center point position is obtained; The shrinkage direction is determined by the distance change of the boundary points of the extracted marked region to the centroid; The shrinkage ratio is calculated using the ratio of the area of the region after shrinkage to the initial area of the region; The shape features of the shrinkage defect are extracted according to the curvature change of the contour points of the extracted marked region to obtain a fourth image; For the shape features extracted from the fourth image, the minimum-maximum value normalization method is used to process the bending defect feature, the twisting defect feature and the shrinkage defect feature data respectively, and a shape feature vector of the thermal deformation defect is constructed according to the feature correlation weight to obtain the shape feature vector of the thermal deformation defect.
4. The method of claim 1, wherein, The shape feature vector and the size feature vector of the thermal deformation defect are fused to construct a comprehensive feature vector of the thermal deformation defect, including: The shape feature vector and the size feature vector in the defect image are obtained, the shape feature vector and the size feature vector are subjected to Z-score standardization processing, and abnormal data is removed using the standard deviation principle to obtain a second feature vector; The Pearson correlation coefficient is calculated according to the feature values in the second feature vector, if the correlation coefficient is positive, the positively correlated features are retained, if the correlation coefficient is negative, the negatively correlated features are retained, and the feature values are assigned weights through the absolute value of the correlation coefficient to obtain a third feature vector; Weighted average calculation is performed on the feature values with assigned weights in the third feature vector, and numerical mapping is performed on the weighted sum result using the maximum-minimum value normalization to obtain a fourth feature vector; Principal component analysis is performed on the normalized feature values in the fourth feature vector, the number of principal components is selected through the cumulative contribution rate threshold, and a comprehensive feature vector is constructed according to the principal component scores to obtain a comprehensive feature vector of the thermal deformation defect.
5. The method of claim 1, wherein, The comprehensive feature vector of the hot deformation defect is input into a preset hot deformation defect recognition model for training, and a discriminant function between the hot deformation defect type and the comprehensive feature vector is established by learning the preset labeled samples, including: A training sample set is obtained by undersampling processing according to the hot deformation defect comprehensive feature vector, the number of bending defect samples, twisting defect samples and shrinkage defect samples in the training sample set is balanced, and a label matrix is constructed for the training sample set; A nonlinear classifier is constructed for the label matrix by using a support vector machine, and the optimal parameter combination is obtained by optimizing the radial basis kernel function parameters and the penalty coefficient through the grid search method; The optimal parameter combination is used to construct a discriminant function, and the support vector is iteratively calculated by a sequential minimal optimization algorithm, and the discriminant function coefficients are obtained according to the maximum interval principle; The discriminant function value is calculated for the discriminant function coefficients, if the discriminant function value is greater than the discriminant threshold, it is determined as the first type of defect, if the discriminant function value is less than the discriminant threshold, it is determined as the second type of defect, and the hot deformation defect discriminant function is obtained by recording the defect recognition result through the confusion matrix.
6. The method of claim 1, wherein, The established discriminant function between the hot deformation defect type and the comprehensive feature vector is used to extract the comprehensive feature vector of the input plastic lace hot deformation defect image, and the hot deformation defect recognition result is obtained according to the output result, and the hot deformation defect recognition result is used to determine the defect type through the discriminant function, and the defect type includes bending, twisting and shrinkage, including: For the shape feature vector and the size feature vector, the feature dimension corresponding to the cumulative contribution rate is obtained by principal component analysis, and the comprehensive feature vector is constructed by serial combination, and the data normalization is performed on the comprehensive feature vector; According to the data normalized comprehensive feature vector, the sample to classification hyperplane distance is calculated by using the preset radial basis kernel function parameters and the penalty coefficient, the defect type probability value is obtained after conversion by the sigmoid function, the discriminant value is calculated by the Broomman multi-class discriminant function, and if the discriminant value exceeds the preset discriminant threshold, it is classified as the current defect type; For the calculated discriminant value, the maximum probability criterion is used to select the defect type, and if the discriminant result exceeds the preset confidence threshold, the hot deformation defect type is determined.
7. The method of claim 1, wherein, The bending defect arc radius threshold value, the twisting defect twist angle threshold value and the shrinkage defect shrinkage proportion threshold value corresponding to the defect type are obtained, if the identified defect arc radius is less than the threshold value and the twist angle is greater than the threshold value and the shrinkage proportion is greater than the threshold value, it is determined that the quality of the plastic lace is unqualified, otherwise it is determined that the quality is qualified, including: The bending defect arc radius value, the twisting defect twist angle value and the shrinkage defect shrinkage proportion value in the plastic lace sample are obtained, and the mean and standard deviation of the three types of defect features are obtained by statistical analysis of the qualified samples; According to the mean and standard deviation of the defect features, the standardized feature values are obtained by standardization processing; For the standardized feature values, the threshold interval boundary is determined by adding and subtracting the standard deviation threshold value from the mean, and the upper limit of the arc radius threshold value, the lower limit of the twist angle threshold value and the lower limit of the shrinkage proportion threshold value are obtained. If the arc radius value is less than the upper arc radius threshold and the torsion angle value is greater than the lower torsion angle threshold and the shrinkage ratio value is greater than the lower shrinkage ratio threshold, it is determined that the plastic lace quality is unqualified, and a binary processing output quality determination mark is adopted.
Citation Information
Patent Citations
Strip steel defect detection method based on image recognition
CN116071316A
Metal mold online detection method and equipment based on computer vision
CN117974665A