Automobile leather surface defect detection method and system based on machine vision
By combining Brouwer's fixed-point theorem and tangent vector field image enhancement with inter-class separation entropy and KNN algorithm, the problem of identifying complex and subtle defects in existing automotive leather inspection is solved, achieving faster and more accurate defect detection and improving the precision and efficiency of leather product quality control.
Patent Information
- Application Number
- CN202511681094.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-17
- Publication Date
- 2026-02-10
AI Technical Summary
Existing methods for detecting defects in automotive leather rely on manual methods or basic algorithms, which make it difficult to effectively identify complex and subtle defects. This results in slow detection speed, low accuracy, and a high risk of missed or false detections, affecting the precision and efficiency of quality control for leather products.
An image enhancement method based on Brouwer's fixed-point theorem and tangent vector field is adopted, combined with inter-class separation entropy and KNN algorithm, to identify and classify defective images by calculating similarity distance and dynamically adjusting K value.
It improves the ability to detect complex and subtle defects, reduces missed and false detections, increases detection speed and accuracy, and enhances the precision and efficiency of quality control for leather products.
Smart Images

Figure CN121504868A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of surface recognition, in particular to a vehicle leather surface defect detection method and system based on machine vision. BACKGROUND
[0002] Machine vision is a technology that uses computers and image processing techniques to simulate human vision for object recognition, analysis and processing. It acquires images through cameras or other sensors and processes them with algorithms to extract features and identify targets, thus completing tasks. Machine vision is widely used in industrial automation, medical imaging, autonomous driving and other fields.
[0003] Vehicle leather surface defect detection is a real-time monitoring of the surface of vehicle leather through machine vision technology to identify possible defects such as flaws, scratches and color differences on the surface of the leather. Through high-resolution cameras and image processing algorithms, the surface of the leather is accurately detected to ensure that the quality of the leather meets the standards. The leather of the car interior not only plays a key role in aesthetics, but also directly affects the user experience of consumers. Any minor flaw can affect the overall texture of the vehicle and even the brand image.
[0004] However, existing vehicle leather defect detection usually relies on manual inspection or uses basic algorithms such as edge detection, color thresholding and contrast adjustment to analyze images. These algorithms are effective for simple defect recognition, but have limitations for complex defect patterns or subtle defect detection. The detection speed is slow, the accuracy is low, and it is easy to miss or misidentify, affecting the precision and efficiency of leather product quality control. SUMMARY
[0005] In view of the above shortcomings of the prior art, the purpose of the embodiments of the present application is to provide a vehicle leather surface defect detection method based on machine vision, which can solve the technical problems that existing vehicle leather defect detection usually relies on manual inspection or uses basic algorithms such as edge detection, color thresholding and contrast adjustment to analyze images. These algorithms are effective for simple defect recognition, but have limitations for complex defect patterns or subtle defect detection. The detection speed is slow, the accuracy is low, and it is easy to miss or misidentify, affecting the precision and efficiency of leather product quality control.
[0006] The first aspect of the embodiments of the present application provides a vehicle leather surface defect detection method based on machine vision, comprising: S1: acquiring a plurality of defect images of the surface of the vehicle leather, wherein each defect image has a defect label; S2: performing image enhancement on the defect images based on the Brouwer fixed point theorem and tangent vector field to obtain an enhanced defect image set; S3: Acquire the image of the leather surface of the car to be inspected; S4: Combine inter-class separation entropy to calculate the similarity distance between the image to be detected and each defect image in the defect image set; S5: Determine the K value for the KNN algorithm by combining the tangent vector field; S6: Based on similarity distance, the nearest neighbor set is determined using the KNN algorithm with the K value; S7: Perform majority voting in the nearest neighbor set to determine and output the defect category of the image to be detected.
[0007] A second aspect of the present invention provides a machine vision-based automotive leather surface defect detection system, comprising: a processor and a memory; The memory stores a program or instructions that can run on a processor, which, when executed by the processor, implement the steps of the machine vision-based automotive leather surface defect detection method as described in the first aspect.
[0008] A third aspect of the present invention provides a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the machine vision-based automotive leather surface defect detection method of the first aspect.
[0009] The beneficial effects of the technical solutions provided in the embodiments of the present invention include at least the following: In this embodiment of the invention, image enhancement by combining Brouwer's fixed-point theorem and tangent vector fields effectively solves the problem of "pseudo-defects" generated by data augmentation in traditional methods, ensuring the diversity and credibility of defect samples. Furthermore, by combining inter-class separation entropy and the KNN algorithm to optimize similarity calculation, and using the K value of the KNN algorithm determined based on the tangent vector field, defect category identification is performed. This improves the accurate identification capability of defect images and enhances the system's ability to detect complex and subtle defects. Compared with traditional methods, the detection speed is faster, the accuracy is higher, and the risk of missed and false detections is reduced, thereby improving the precision and efficiency of leather product quality control. Attached Figure Description
[0010] The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Throughout the drawings, the same reference numerals denote the same parts. Obviously, the drawings described below are merely some embodiments of the present invention, and those skilled in the art can obtain other drawings based on these drawings without any creative effort.
[0011] Figure 1 This is a schematic flowchart of a machine vision-based method for detecting surface defects in automotive leather, provided in an embodiment of the present invention. Figure 2 This is a schematic diagram of a machine vision-based automotive leather surface defect detection system provided in an embodiment of the present invention. Detailed Implementation
[0012] To enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. It should be understood that these descriptions are merely exemplary and are not intended to limit the scope of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0013] The following description, in conjunction with the accompanying drawings, details the machine vision-based method for detecting surface defects in automotive leather provided by the present invention through specific embodiments and application scenarios.
[0014] Reference manual attached Figure 1 The diagram shows a flowchart of a machine vision-based method for detecting surface defects in automotive leather, as provided in an embodiment of the present invention.
[0015] This invention provides a machine vision-based method for detecting surface defects in automotive leather, which may include the following steps: S1: Acquire multiple defect images of the automotive leather surface, each defect image bearing a defect label.
[0016] Among them, defect labeling refers to labeling each of the multiple defect images collected on the surface of automotive leather with the type of defect.
[0017] In one possible implementation, defect labels include scratch labels, wrinkle labels, and hole labels.
[0018] S2: Based on Brouwer's fixed-point theorem and tangent vector field, image enhancement is performed on the defect image to obtain an enhanced set of defect images.
[0019] Brouwer's fixed-point theorem is an important theorem in mathematics, primarily used to describe that under certain conditions, a function mapping must have a fixed point. Specifically, if a continuous function maps itself to a compact convex set, then the function will have at least one point where its value is equal to the value of that point. This theorem is widely used in mathematics, economics, physics, and other fields to guarantee the existence of solutions to certain problems. A tangent vector field is a vector field defined on a manifold, typically used to describe fluid dynamics or particle motion. A tangent vector field defines a vector at each point to represent the direction or trend of flow. In image processing, tangent vector fields can help describe the changing trends between pixels in an image, used to enhance or transform image structure.
[0020] It should be noted that image enhancement using Brouwer's fixed-point theorem and tangent vector fields not only generates diverse defect images but also ensures the realism of these enhanced images, thus avoiding the false defect problems that may arise in traditional data augmentation methods (such as random cropping and rotation). Supported by mathematical theory, the generated enhanced images maintain their credibility while representing the diversity of defects, enabling the defect detection system to learn and recognize complex defect patterns more accurately, thereby improving detection accuracy and robustness.
[0021] In one possible implementation, S2 specifically includes: S201: Convert the defect image into a tangent vector field describing the grayscale change state of the defect image, wherein the grayscale change state of the defect image includes the direction of grayscale change and the intensity of grayscale change.
[0022] The formula for the tangent vector field is as follows: in, Represents the coordinates in the defect image Tangent vector field at point, Represents the coordinates in the defect image The gray-level gradient operator at that location, This represents the convolution operator. This represents an adaptive Gaussian kernel.
[0023] Optionally, the standard deviation in the adaptive Gaussian kernel can be set according to the physical morphological differences of the defect type (scratches / wrinkles / holes). For scratches, i.e., thin linear features, a smaller kernel of 1.2 can be used to preserve detailed edges. For wrinkles, i.e., large-area undulating features, a larger kernel of 2 can be used to smooth high-frequency noise. For holes, i.e., locally closed features, a minimum kernel of 0.8 can be used to enhance edge sharpness.
[0024] It should be noted that by converting the defect image into a tangent vector field and combining it with an adaptive Gaussian kernel, the direction and intensity of grayscale changes in the image are effectively described. By adjusting the standard deviation of the Gaussian kernel according to different defect types (such as scratches, wrinkles, and holes), image processing can be dynamically optimized based on the physical morphological characteristics of the defects. Smaller Gaussian kernels preserve details, while larger kernels effectively smooth noise. This fine control ensures that the enhanced image can highlight the characteristics of different defects, while avoiding over-smoothing or information loss, thus improving the accuracy and robustness of defect detection.
[0025] S202: Determine the local curvature of the defect describing the tangent vector field at different coordinates. The larger the local curvature of the defect, the more significant the defect features.
[0026] The specific formula for calculating the local curvature of the defect is as follows: in, Represents the tangent vector field In different coordinates The local curvature of the defect at the location, and Representing the tangent vector field respectively The rate of change of gradient in the x-direction and the rate of change of gradient in the y-direction, Represents the tangent vector field The length of the cube.
[0027] It should be noted that by calculating the local curvature of the tangent vector field, the salience of defects at different locations can be accurately quantified. Areas with larger local curvature values indicate more prominent defect features, which helps to accurately identify details and edges in the image. This method, by considering the rate of change of the tangent vector field in the x and y directions, makes defect features more accurate and distinguishable, while avoiding misjudgment of blurry or inconspicuous defects, enhancing the ability to identify key defect regions in the image, and improving the accuracy of defect detection.
[0028] S203: Combine the tangent vector field and the local curvature of the defect to determine the defect transformation operator that controls the enhancement intensity of the defect state.
[0029] The specific calculation formula for the defect transformation operator is as follows: in, Indicates the control parameters related to defect status. Related defect transformation operators, This represents the natural exponential function. This represents the defect region obtained based on the image segmentation algorithm. and These represent the defect areas. The maximum and minimum local curvature of the defect in the model. Represents the area of the defect image. The gradient circulation at the defect boundary Indicates the boundary along the defect region A closed-circuit integral over a week, This represents the infinitesimal components on the boundary of the defect region. Indicates the boundary of the defect area.
[0030] in, When it is 0, it is the original defect state with no enhancement; when it is 1, it is the state of maximum enhancement.
[0031] The defect transformation operator can be proven to satisfy the homeomorphism condition, ensuring defect category invariance (according to Brouwer's fixed-point theorem). By combining the tangent vector field and the local curvature of the defect, it is determined that the defect transformation operator can precisely control the intensity of defect enhancement. This method achieves a smooth transition from the original defect to the maximum enhancement state by adjusting the control parameter λ, allowing different types of defects to be appropriately enhanced according to their characteristics. In particular, by considering the curvature and boundary gradient of the defect region, the enhancement effect can be dynamically adjusted according to the defect geometry, thereby improving detection accuracy and robustness. Simultaneously, the transformation operator satisfies the homeomorphism condition, ensuring defect category invariance and avoiding the loss of category information during enhancement.
[0032] Specifically, Brouwer's fixed-point theorem requires that the mapping satisfy the homeomorphism condition, namely, continuity and compact convex set condition. The following explains how Brouwer's fixed-point theorem constrains this defect transformation operator from three aspects: 1. By the defect transformation operator... The calculation formula uses parameters that are combinations of continuous functions (curvature is generated by the gradient operator, and the boundary integral is the integral of a continuous function). The input to an exponential function is continuous, and ultimately, the function itself is also continuous. 2. Defect Area It is a closed region obtained through an image segmentation algorithm, and its boundary is... It is a closed curve, therefore, It is a compact convex set (closed and bounded). Furthermore, the region of effect of the defect transformation operator is... Rather than the entire image domain, it can be considered as a... The self-mapping, i.e., the defect transformation operator, satisfies the conditions of continuity and compact convex set, and Brouwer's fixed-point theorem holds. 3. As mentioned above, the defect transformation operator... All parameters are combinations of continuous functions, exponential functions. Monotony ensures It is bijective (one-to-one correspondence), because The inverse mapping is Since the logarithmic function is continuous within its domain, its inverse mapping is also continuous. Based on this, the defect transformation operator... It is a homeomorphism, thus ensuring the invariance of the defect category and conforming to the Brouwer fixed-point theorem constraint. Therefore, the defect transformation operator that controls the enhancement intensity of the defect state, determined under the Brouwer fixed-point theorem constraint, can ensure the invariance of the defect category during the enhancement process.
[0033] S204: The tangent vector field is enhanced by the defect transformation operator to obtain the enhanced tangent vector field.
[0034] The enhancement formula is as follows: in, Representing coordinates Enhanced tangent vector field at the location, This represents the deformation coefficient associated with the defect category. This indicates the calculation of curl. This represents the local curvature gradient of the defect. This indicates a small variable that avoids division by zero, and the subscript T indicates transpose.
[0035] Optionally, the deformation coefficient can be selected as follows: for scratches, the deformation coefficient can be set to 0.05; for wrinkles, the deformation coefficient can be set to 0.12; and for holes, it can be set to 0.08.
[0036] It should be noted that by enhancing the tangent vector field and using the defect transformation operator to adjust the saliency of defects in the image, the characteristics of different types of defects can be effectively highlighted. The curl and local curvature gradient in the enhancement formula combine the local structural information of the defect, making the image enhancement more accurate. By adjusting the deformation coefficient, defect features are adaptively enhanced according to different defect types (such as scratches, wrinkles, and holes), avoiding over- or under-enhancement. This method can both enhance the identifiability of defects and maintain the authenticity of image details, improving the accuracy and robustness of defect detection.
[0037] S205: Perform gradient integration on the enhanced tangent vector field to inversely obtain the image grayscale values at different coordinates, thereby enhancing the defect image and obtaining a set of defect images.
[0038] Specifically, step S205, which involves performing gradient integration on the enhanced tangent vector field to deduce the image grayscale values at different coordinates, involves: First, calculating the gradient of the tangent vector field, which represents the change in local curvature of the defect image. The gradient indicates the rate of grayscale change at that point. Next, the local change information of the tangent vector field is integrated using curl operations to enhance the details of the defects in the image. Finally, the image grayscale value at each coordinate point is deduced through gradient integration, thus restoring the enhanced image.
[0039] Specifically, this process enhances the accuracy and robustness of defect detection by enhancing defect images. First, the defect image is converted into a tangent vector field, describing the direction and intensity of grayscale changes in the image. An adaptive Gaussian kernel is used to smooth the features of different defect types, thereby enhancing the recognition ability of different defect types. Then, the salience of the defect is quantified by calculating the local curvature; the greater the local curvature, the more significant the defect. Next, a defect transformation operator is designed by combining the tangent vector field and local curvature to control the enhancement intensity of the defect state, ensuring appropriate enhancement for different defects. Enhancing the tangent vector field based on the defect transformation operator highlights the characteristics of the defect while avoiding the risk of generating false defects during image enhancement. Finally, the grayscale values of the image are inversely calculated through gradient integration, thereby enhancing the defect image and obtaining a set of finely enhanced defect images. The advantages of this method are that it combines mathematical theory and image processing, ensuring the realism and diversity of the enhanced images, avoiding false defects that may be introduced by traditional enhancement methods, and precisely controlling the enhancement process to ensure that different types of defects are appropriately processed, thus improving the accuracy and robustness of defect detection.
[0040] More specifically, the relationship between the defect transformation operator and Brouwer's fixed-point theorem is as follows: 1. From the defect transformation operator... The calculation formula uses parameters that are combinations of continuous functions (curvature is generated by the gradient operator, and the boundary integral is the integral of a continuous function). The input to an exponential function is continuous, and ultimately, the function itself is also continuous. 2. Defect Area It is a closed region obtained through an image segmentation algorithm, and its boundary is... It is a closed curve, therefore, It is a compact convex set (closed and bounded). Furthermore, the region of effect of the defect transformation operator is... Rather than the entire image domain, it can be considered as a... The self-mapping, i.e., the defect transformation operator, satisfies the conditions of continuity and compact convex set, and Brouwer's fixed-point theorem holds. 3. As mentioned above, the defect transformation operator... All parameters are combinations of continuous functions, exponential functions. Monotony ensures It is bijective (one-to-one correspondence), because The inverse mapping is Since the logarithmic function is continuous within its domain, its inverse mapping is also continuous. Based on this, the defect transformation operator... It is a homeomorphism, thus ensuring the invariance of the defect category and satisfying the constraints of Brouwer's fixed point theorem.
[0041] Therefore, the defect transformation operator, determined under the constraints of Brouwer's fixed-point theorem, which controls the enhancement intensity of defect states, can ensure the invariance of defect categories during the enhancement process. In other words, the defect transformation operator is determined under multiple constraints satisfying Brouwer's fixed-point theorem to ensure the invariance of defect categories during enhancement.
[0042] S3: Acquire the image of the leather surface of the car to be inspected.
[0043] S4: Combine inter-class separation entropy to calculate the similarity distance between the image to be detected and each defect image in the defect image set.
[0044] Inter-class separation entropy is an indicator used to measure the degree of difference between different categories. In classification problems, inter-class separation entropy reflects the degree of separability between categories; the larger the value, the more obvious the differences between categories, and the better the classification effect. It is often used to evaluate information gain in feature selection or image enhancement, helping to determine which features or image information are most critical for classification. Similarity distance is a measure of the similarity between two samples; commonly used distances include Euclidean distance and Manhattan distance. In step S4, similarity distance is evaluated by calculating the distance between the image to be detected and each defect image in the defect image set. The higher the similarity and the smaller the distance, the more similar the features between the images; conversely, a smaller distance indicates greater differences.
[0045] This method maintains the simplicity and speed of KNN in detecting surface defects while achieving feature selection capabilities similar to deep neural networks. It avoids the "curse of dimensionality" problem encountered by KNN in high-dimensional spaces, where the distance differences between samples become less significant as the number of features increases, affecting classification performance. It mitigates the impact of distance on the number of feature dimensions, thereby increasing the accuracy of defect category classification.
[0046] By dynamically analyzing the discriminative power of feature dimensions, nonlinear enhancement weights are assigned to dimensions with high discriminative power, while exponential decay suppression is applied to dimensions with low discriminative power. This automatically focuses on key features when calculating distance, weakening the influence of redundant dimensions. The method quantifies discriminative power through the relative entropy between feature dimensions, achieving "soft dimension filtering" without dimensionality reduction.
[0047] In one possible implementation, S4 specifically includes: S401: In the defect image set, calculate the inter-class separation entropy of different feature dimensions for different defect categories.
[0048] The specific formula for calculating inter-class separation entropy is as follows: in, Represents a set of defect categories. Indicates the number of defect categories. Indicating in the feature dimension The above belongs to the defect category The mean eigenvalues of all defect images Indicating in the feature dimension The above belongs to the defect category The standard deviation of the eigenvalues of all defect images Represents the logarithmic function. This represents the standard deviation of eigenvalues for all defect categories along feature dimension d across the entire defect image set. This represents the average eigenvalue of all defect categories along feature dimension d across the entire defect image set. The inter-class separation entropy represents the ability of a single feature dimension d to separate different defect categories. The larger the value, the better it can separate different defect categories.
[0049] It's important to note that inter-class separation entropy, by calculating a quantified value of each feature dimension's ability to separate defect categories, can accurately assess the importance of each feature dimension in distinguishing different defect categories. A higher value indicates a better ability of that feature dimension to differentiate between different defects, which helps optimize feature selection and improve detection accuracy. This method can more effectively identify and classify complex defect features, improve the system's sensitivity to subtle differences, avoid interference from irrelevant features, and ensure the accuracy and robustness of detection results.
[0050] S402: The dimension weights are obtained by nonlinearly mapping the inter-class separation entropy using the hyperbolic tangent function.
[0051] The specific dimensional weights are as follows: in, This represents the dimensional weight of feature dimension d. Represents the hyperbolic tangent function. Indicates all The median of Indicates all standard deviation The sharpening factor represents the degree of steepness of the input hyperbolic tangent function. This represents the weight offset.
[0052] It should be noted that by using the hyperbolic tangent function to perform a nonlinear mapping of the inter-class separation entropy, the weights of feature dimensions can be dynamically adjusted, strengthening the influence of high-discriminative features while suppressing the interference of low-discriminative features. The application of the hyperbolic tangent function significantly amplifies high-discriminative dimensions (such as edges and textures) in similarity calculation, while effectively weakening low-discriminative dimensions (such as background noise). This approach not only improves the accuracy of feature selection but also mitigates the "distance dilution" problem common in high-dimensional spaces, enhancing the accuracy and robustness of defect detection.
[0053] Optionally, the sharpening factor can be set to 3, and the weight offset can be set to 1. Through this formula, high-discrimination dimensions (such as the edges of defects and texture features) are significantly amplified in distance calculation, while low-discrimination dimensions (such as background noise) are weakened, thereby alleviating the "distance dilution" problem in high-dimensional space.
[0054] S403: Combine dimensional weights to calculate similarity distance.
[0055] In one possible implementation, the dimension weights are specifically positive dimension weights, and S403 specifically includes: S4031: Positive dimension weights in statistical dimension weights.
[0056] S4032: Introduce positive dimension weights into Mahalanobis distance to calculate similarity distance.
[0057] The formula for calculating similarity distance is as follows: in, D represents the similarity distance between the image to be detected, A, and the defective image, B, where D represents the total dimension of the features. and Let represent the feature values of the image to be detected, A, and the defective image, B, respectively, along the feature dimension d. Indicates and The relevant indicator function, if If the value is 1, the indicator function is 1; otherwise, the indicator function is 0.
[0058] It's important to note that this method of calculating feature distance can mitigate the interference of low-discriminative dimensions (redundant features), alleviating the "curse of dimensionality." By statistically weighting positive dimensions and incorporating them into the Mahalanobis distance calculation, the calculation of similarity distance focuses more on high-discriminative features, reducing the interference of low-discriminative features. Specifically, the formula adjusts the contribution of different dimensions to the similarity calculation through weighting, ensuring that important features (such as edges and textures) have a greater impact on similarity. The indicator function ensures that only dimensions with positive weights participate in the calculation, thus avoiding the influence of redundant features on the distance calculation. This method effectively alleviates the "curse of dimensionality" problem common in high-dimensional spaces, improves the efficiency and accuracy of similarity calculation, and enables defect detection to more accurately identify and classify complex image features.
[0059] Specifically, this process quantifies the ability of different feature dimensions to distinguish defect categories by calculating inter-class separation entropy, and further uses a hyperbolic tangent function to perform a nonlinear mapping of the inter-class separation entropy, thereby obtaining the weight of each feature dimension. High-discriminative features (such as edges and textures) are significantly enhanced in similarity calculation, while low-discriminative features (such as background noise) are weakened. This helps to mitigate the "distance dilution" problem caused by feature redundancy in high-dimensional space. By combining these dimensional weights, the similarity distance between defect images can be accurately calculated, making the distinction between defect categories more precise, thereby improving the robustness and accuracy of the defect detection system in complex environments. This method effectively improves the utilization efficiency of image features and enhances the classification and detection effects.
[0060] S5: Determine the K value of the KNN algorithm by combining the tangent vector field.
[0061] In the KNN algorithm, the K value refers to the number of neighbors used for classification. In KNN, when classifying a sample, the algorithm finds the K nearest training samples and determines the label of the sample based on a majority vote of these K neighbors. The choice of K value is crucial to the algorithm's performance: a small K value (e.g., K=1) may cause the model to be very sensitive to noise in the data, easily leading to overfitting, meaning the model overlearns the details of the training data and cannot generalize to new data. A large K value (e.g., K=100) may cause the model to be too simple, losing sensitivity to the local structure of the data, resulting in underfitting and failing to accurately capture complex data features.
[0062] It's important to note that using the tangent vector field to determine the K value in the KNN algorithm aims to optimize the selection of K based on the local features of the data. The tangent vector field provides local structural information about the image or data, helping to choose a K value that is neither too sensitive nor too simplistic. This approach avoids the overfitting or underfitting problems caused by inappropriate K value selection in traditional KNN algorithms, enabling the model to more accurately capture local features of the data and improve the accuracy and robustness of defect detection.
[0063] In one possible implementation, S5 specifically includes: S501: Calculate the tangent vector field of the image to be detected.
[0064] S502: Calculate the local curvature of the defect in the tangent vector field.
[0065] S503: Determine the K value of the KNN algorithm based on the local curvature of the defect.
[0066] The specific formula for calculating the K value in the KNN algorithm is as follows: in, This represents the K value of the KNN algorithm used to detect the image A. This represents the average local curvature of the defect at each coordinate point in the image A to be inspected. and These represent the preset minimum and maximum allowable K values, respectively. Represents the natural constant. This represents the square of the L2 norm.
[0067] Specifically, by calculating the tangent vector field and the local curvature of the defect in the image to be detected, local features of the image are extracted and their complexity is quantified. Then, the K value in the KNN algorithm is dynamically adjusted using the average local curvature of the defect in the image to be detected. This calculation formula allows the K value to automatically change according to the complexity of the image defect; when the defect is more complex, the K value is smaller, and vice versa. This method, by adaptively adjusting the K value, enables the KNN algorithm to more accurately capture local defect features, reduce noise interference, and avoid overfitting or underfitting problems caused by a fixed K value, thereby improving the accuracy and robustness of defect detection.
[0068] S6: Based on similarity distance, the nearest neighbor set is determined using the KNN algorithm with the K value.
[0069] It's important to note that the nearest neighbor set of the image to be detected is determined by calculating the similarity distance between the image to be detected and the labeled defect images, and combining this with the predetermined K value of the KNN algorithm. Specifically, by calculating the similarity distance, the K defect images that are most similar in features to the image to be detected are found. These nearest neighbor images are the closest to the image to be detected in the feature space. In this way, the algorithm can predict the defect category based on these similar samples, helping to improve the accuracy of the detection results. This step is the core of the KNN algorithm, enabling the model to accurately infer the defect type of the image to be detected based on the similarity of known data.
[0070] In one possible implementation, S6 specifically includes: S601: Determine the similarity distance between each defective image in the defective image set and the image to be detected.
[0071] S602: Select K defect images with a similarity distance less than the preset similarity distance and the same value as K to obtain the nearest neighbor set.
[0072] It should be noted that those skilled in the art can set the preset similarity distance according to actual needs, and this invention does not limit this.
[0073] It should be noted that by calculating the similarity distance between each defect image and the image to be detected, and selecting the K most similar defect images that match the K value, the method ensures that highly similar samples contribute the most to the classification results. This approach not only improves computational efficiency but also reduces the impact of noise by selecting the most relevant neighbors, resulting in more accurate defect category identification and enhancing the system's robustness in complex detection tasks.
[0074] S7: Perform majority voting in the nearest neighbor set to determine and output the defect category of the image to be detected.
[0075] It's important to note that the majority voting mechanism in the KNN algorithm is used to vote on the K nearest neighbors in the nearest neighbor set to determine the defect category of the image to be detected. Specifically, the labels of the K nearest neighbor images are voted on, and the defect category that appears most frequently is selected as the final category of the image to be detected. This process can effectively reduce noise interference and improve the stability and accuracy of classification. The majority voting mechanism makes the final classification result less susceptible to the influence of individual outliers, thereby improving the reliability and accuracy of defect detection.
[0076] In one possible implementation, S7 specifically includes: S701: Count the total number of defect categories to which all defect images in the nearest neighbor set belong.
[0077] S702: Output the defect category corresponding to the maximum total number of defect categories as the defect category of the image to be detected.
[0078] Understandably, by counting the total number of each defect category in the nearest neighbor set and performing a majority vote, it is possible to ensure that the defect category of the image to be detected is determined by the most representative category. This method effectively reduces the impact of outlier data or noise, uses the most common defect category as the final output, and improves the stability and accuracy of the classification results. Especially in complex or ambiguous defect detection tasks, it ensures efficient and reliable classification decisions.
[0079] In practical applications, the machine vision-based method for detecting defects on automotive leather surfaces first acquires defect images labeled with different types of defects (such as scratches, wrinkles, and holes). Next, Brouwer's fixed-point theorem and tangent vector fields are used to enhance the images, generating diverse and reliable enhanced images that effectively improve the feature representation of the defect images. Then, the saliency of the defects is quantified by calculating the local curvature and tangent vector field of the defect images, and the enhancement intensity is precisely controlled. The subsequent similarity calculation combines inter-class separation entropy, nonlinear mapping, and Mahalanobis distance to optimize feature weights and avoid the "curse of dimensionality" in high-dimensional space, thus more accurately calculating the similarity between defect images. Finally, the K-value is dynamically adjusted using the KNN algorithm, and the nearest neighbor image is selected through majority voting to determine the defect category of the image to be detected. This method significantly improves the accuracy and robustness of defect recognition, effectively handles complex defect types, reduces noise impact, and ensures the efficiency and reliability of the detection system in practical applications.
[0080] The beneficial effects of the technical solutions provided in the embodiments of the present invention include at least the following: In this embodiment of the invention, image enhancement by combining Brouwer's fixed-point theorem and tangent vector fields effectively solves the problem of "pseudo-defects" generated by data augmentation in traditional methods, ensuring the diversity and credibility of defect samples. Furthermore, by combining inter-class separation entropy and the KNN algorithm to optimize similarity calculation, and using the K value of the KNN algorithm determined based on the tangent vector field, defect category identification is performed. This improves the accurate identification capability of defect images and enhances the system's ability to detect complex and subtle defects. Compared with traditional methods, the detection speed is faster, the accuracy is higher, and the risk of missed and false detections is reduced, thereby improving the precision and efficiency of leather product quality control.
[0081] Reference manual attached Figure 2 The diagram shows a schematic of the structure of a machine vision-based automotive leather surface defect detection system provided in an embodiment of the present invention.
[0082] This invention provides a machine vision-based automotive leather surface defect detection system 20, comprising: a processor 201 and a memory 202; The memory 202 stores programs or instructions that can run on the processor 201. When the program or instructions are executed by the processor 201, they implement the steps of the above-described machine vision-based automotive leather surface defect detection method and achieve the same technical effect. To avoid repetition, the present invention will not elaborate further.
[0083] It should be understood that the processor 201 in this embodiment of the invention may be a central processing unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.
[0084] It should also be understood that the memory 202 in the embodiments of the present invention can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of random access memory are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DR RAM).
[0085] The above embodiments can be implemented, in whole or in part, by software, hardware (such as circuits), firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more sets of available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium. A semiconductor medium can be a solid-state drive.
[0086] It should be understood that, in various embodiments of the present invention, the order of the above-mentioned process numbers does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0087] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0088] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the devices, apparatuses, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0089] In the several embodiments provided by this invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0090] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0091] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0092] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0093] This invention provides a readable storage medium comprising: storing a program or instructions on the readable storage medium, wherein when the program or instructions are executed by a processor, the program or instructions implement the steps of the above-described machine vision-based automotive leather surface defect detection method and achieve the same technical effect. To avoid repetition, this invention will not elaborate further.
[0094] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the embodiments of the present invention, and are not intended to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the protection scope of the present invention.
Claims
1. A machine vision-based method for detecting surface defects in automotive leather, characterized in that, include: S1: Acquire multiple defect images of the automotive leather surface, wherein each defect image is labeled with a defect tag; S2: Based on Brouwer's fixed-point theorem and tangent vector field, the defect image is enhanced to obtain a set of enhanced defect images; S3: Obtain the image to be detected on the surface of the car leather; S4: Calculate the similarity distance between the image to be detected and each defect image in the defect image set by combining the inter-class separation entropy; S5: Determine the K value for the KNN algorithm based on the aforementioned tangent vector field; S6: Based on the similarity distance, determine the nearest neighbor set using the K value of the KNN algorithm; S7: Perform majority voting in the nearest neighbor set to determine and output the defect category of the image to be detected.
2. The method for detecting surface defects in automotive leather based on machine vision according to claim 1, characterized in that, The defect labels include scratch labels, wrinkle labels, and hole labels.
3. The method for detecting surface defects in automotive leather based on machine vision according to claim 1, characterized in that, S2 specifically includes: S201: Convert the defect image into a tangent vector field describing the grayscale change state of the defect image, wherein the grayscale change state of the defect image includes the grayscale change direction and the grayscale change intensity of the defect image. S202: Determine the local curvature of the defect describing the tangent vector field at different coordinates, wherein the larger the local curvature of the defect, the more significant the defect feature; S203: Combine the tangent vector field and the local curvature of the defect to determine the defect transformation operator that controls the enhancement intensity of the defect state; S204: Perform image enhancement on the tangent vector field according to the defect transformation operator to obtain the enhanced tangent vector field; S205: Perform gradient integration on the enhanced tangent vector field to inversely obtain the image grayscale values at different coordinates, thereby enhancing the defect image and obtaining the defect image set.
4. The method for detecting surface defects in automotive leather based on machine vision according to claim 1, characterized in that, S4 specifically includes: S401: In the set of defect images, calculate the inter-class separation entropy of different feature dimensions for different defect categories; S402: Obtain the dimension weights by performing a nonlinear mapping on the inter-class separation entropy using the hyperbolic tangent function; S403: Calculate the similarity distance by combining the dimensional weights.
5. The machine vision-based method for detecting surface defects in automotive leather according to claim 4, characterized in that, The dimensional weights are specifically positive dimensional weights, and S403 specifically includes: S4031: Calculate the weights of the positive dimensions in the stated dimension weights; S4032: Incorporate the positive dimension weights into Mahalanobis distance to calculate the similarity distance.
6. The method for detecting surface defects in automotive leather based on machine vision according to claim 1, characterized in that, S5 specifically includes: S501: Calculate the tangent vector field of the image to be detected; S502: Calculate the defect local curvature of the tangent vector field; S503: Determine the K value of the KNN algorithm based on the local curvature of the defect.
7. The method for detecting surface defects in automotive leather based on machine vision according to claim 1, characterized in that, S6 specifically includes: S601: Determine the similarity distance between each defective image in the defective image set and the image to be detected; S602: Select K defect images with a similarity distance less than the preset similarity distance and the same value as K to obtain the nearest neighbor set.
8. The method for detecting surface defects in automotive leather based on machine vision according to claim 1, characterized in that, Specifically, S7 includes: S701: Calculate the total number of defect categories to which all defect images in the nearest neighbor set belong; S702: Output the defect category corresponding to the maximum total number of defect categories as the defect category of the image to be detected.
9. A machine vision-based system for detecting surface defects in automotive leather, characterized in that, include: Processor and memory; The memory stores programs or instructions that can run on the processor, which, when executed by the processor, implement the steps of the machine vision-based method for detecting surface defects in automotive leather as described in any one of claims 1 to 8.
10. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the machine vision-based method for detecting surface defects in automotive leather as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Industrial vision detection method based on deep learning
CN112348772A
Textile defect detection method and system based on machine vision
CN118898610A
Vector graphics with controlled thin-plate splines
US20120320063A1
Automated substrate defect identification using multiple classification engine models
US20250336053A1