A textile defect detection method and system based on machine vision
Through machine vision -based textile defect detection methods, the Laplas pyramids and directional filters are used to decompose, the Gaussian hybrid model and enhanced Bayesian classifier, which solves the problem of high efficiency of the cost of artificial detection. Accurate textile defect detection has optimized the production process.
Patent Information
- Application Number
- CN202411396499.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-09
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2044-10-09
AI Technical Summary
The existing textile defect inspection is still in the artificial quality inspection stage, with high cost and low efficiency, which restricts the development of textile manufacturing industry.
Adopt a textile defect detection method based on machine vision, by obtaining textile images, the Laplas pyramid decomposition and directional filter decomposition, extract frequency and direction information, combine the broader Gaussian hybrid model extraction description parameters, build a enhanced Bayesian classification classification Dead type recognition.
It significantly improves the accuracy and efficiency of textile defect detection, reduces the misjudgment rate, improves the processing speed, realizes the efficient and quality control of batch textiles, optimizes the production process, and reduces costs and improves efficiency.
Smart Images

Figure CN118898610B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular to a method and system for detecting textile defects based on machine vision. Background Art
[0002] Textile defects refer to various problems found during the textile printing and dyeing stage of textiles, which may affect the appearance, structural integrity, function or durability of textiles. Common defects include structural defects such as broken yarn, missing needles, and uneven tightness; appearance defects such as stains, color difference, and printing errors; and functional defects such as poor water resistance and insufficient wear resistance. These defects may be caused by a variety of factors such as poor raw material quality, aging production equipment, operating errors or improper post-processing. For the textile industry, these defects not only affect the market performance of products, but may also cause consumer dissatisfaction and complaints, and damage the company's reputation.
[0003] In the textile printing and dyeing process, high-standard defect detection processes can help manufacturers identify and correct production defects early, thereby reducing costs and preventing inferior products from entering the market. Systematic defect detection can not only protect consumers from poor quality products, but also maintain the positive image of the brand and prevent legal proceedings and reputation crises caused by quality problems. In addition, by implementing strict quality control measures, companies can improve production efficiency, reduce waste, and optimize resource allocation, thereby maintaining competitiveness in a highly competitive market and achieving sustainable development.
[0004] However, the existing textile defect detection is still at the manual quality inspection stage, which is costly and inefficient, restricting the development of the textile manufacturing industry. Summary of the invention
[0005] In order to solve the technical problem that textile defect detection in the prior art is still at the manual quality inspection stage, with high cost and low efficiency, which restricts the development of the textile manufacturing industry, the present invention provides a textile defect detection method and system based on machine vision.
[0006] The technical solution provided by the embodiment of the present invention is as follows:
[0007] First aspect
[0008] An embodiment of the present invention provides a method for detecting textile defects based on machine vision, comprising:
[0009] S1: Acquire a textile image set, wherein the textile image set includes textile images with normal labels and labels of different defect categories;
[0010] S2: performing Laplacian pyramid decomposition and directional filter decomposition on the textile image in sequence to extract subband information of the textile image, wherein the subband information of the textile image includes frequency information and directional information corresponding to the frequency information;
[0011] S3: extracting description parameters of the subband information of the textile image through a generalized Gaussian mixture model with multiple Gaussian components, wherein the description parameters include mean, standard deviation and mixing weight, and the description parameters are the same as the label of the textile image;
[0012] S4: Based on the hidden relationship between the description parameters, an enhanced Bayesian classifier is constructed, wherein the enhanced Bayesian classifier includes nodes, class variable nodes and directed edges, wherein each node corresponds to a description parameter, the class variable node is a label corresponding to the description parameter, and the directed edge represents the association relationship between each description parameter and between each description parameter and the class variable node;
[0013] S5: The description parameters of each textile image and the labels corresponding to the description parameters are used as a training set to train the enhanced Bayesian classifier, construct an enhanced Bayesian classifier with complete directed edges and generate a conditional probability table of the enhanced Bayesian classifier;
[0014] S6: Acquire the fabric image to be detected;
[0015] S7: Generate description parameters of the fabric image to be detected;
[0016] S8: Input the description parameters of the fabric image to be detected into the trained enhanced Bayesian classifier, and output the defect type of the fabric image to be detected.
[0017] Second aspect
[0018] An embodiment of the present invention provides a textile defect detection system based on machine vision, comprising:
[0019] processor;
[0020] A memory having computer-readable instructions stored thereon, wherein when the computer-readable instructions are executed by the processor, the method for detecting textile defects based on machine vision as described in the first aspect is implemented.
[0021] The third aspect
[0022] An embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, the method for detecting textile defects based on machine vision as described in the first aspect is implemented.
[0023] The beneficial effects brought about by the technical solution provided by the embodiment of the present invention include at least:
[0024] In the present invention, the frequency and directional information of the textile image are analyzed in detail through Laplacian pyramid and directional filter decomposition, and the subtle defects on the fabric surface are captured. Then, the generalized Gaussian mixture model is used to extract the key descriptive parameters that can comprehensively reflect the state and characteristics of the textile, namely the mean, standard deviation and mixing weight. Then, the relationship between these descriptive parameters is learned, not only the independent characteristics of the parameters are learned, but also the association between the parameters are learned, so as to more accurately distinguish the defect type, and then a more sophisticated decision network, namely the enhanced Bayesian classifier, is constructed, so that the final defect recognition not only depends on a single image feature, but is based on a comprehensive analysis of multiple dimensions, which can effectively improve the generalization ability of the classifier, significantly improve the accuracy of defect detection, reduce the misjudgment rate, and at the same time improve the processing speed, so that the quality control of batch textiles is more efficient and reliable. This textile defect detection based on machine vision can make up for the problem of high cost and low efficiency of manual detection in the traditional textile defect detection process, optimize the textile production process, reduce costs and increase efficiency, and enhance product competitiveness. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0026] Figure 1 A schematic diagram of a process flow of a textile defect detection method based on machine vision provided by an embodiment of the present invention;
[0027] Figure 2 A schematic diagram of the structure of an enhanced Bayesian classifier provided by an embodiment of the present invention;
[0028] Figure 3 A structural schematic diagram of a textile defect detection system based on machine vision provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0029] The technical solution of the present invention is described below in conjunction with the accompanying drawings.
[0030] In the embodiments of the present invention, words such as "exemplarily" and "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "example" in the present invention should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of the word "example" is intended to present the concept in a specific way. In addition, in the embodiments of the present invention, the meaning expressed by "and / or" can be both, or it can be either of the two.
[0031] In the embodiments of the present invention, "image" and "picture" can sometimes be used interchangeably. It should be noted that when the difference between them is not emphasized, the meanings they intend to express are the same. "of", "corresponding, relevant" and "corresponding" can sometimes be used interchangeably. It should be noted that when the difference between them is not emphasized, the meanings they intend to express are the same.
[0032] In the embodiments of the present invention, sometimes the subscripts such as W 1 It may be mistakenly written as a non-subscript form such as W1. When the difference is not emphasized, the meanings they express are the same.
[0033] In order to make the technical problems, technical solutions and advantages to be solved by the present invention more clear, a detailed description will be given below with reference to the accompanying drawings and specific embodiments.
[0034] Reference Manual Attached Figure 1 , which shows a flow chart of a method for detecting textile defects based on machine vision provided by an embodiment of the present invention.
[0035] The embodiment of the present invention provides a method for detecting textile defects based on machine vision, which can be implemented by a textile defect detection device based on machine vision, and the textile defect detection device based on machine vision can be a terminal or a server. The processing flow of the method for detecting textile defects based on machine vision can include the following steps:
[0036] S1: Obtain a textile image set, wherein the textile image set includes textile images with normal labels and labels of different defect categories.
[0037] Among them, the normal label refers to the textile image without any defects, while the defect category label represents the textile image with specific types of defects, such as holes, stains, thread ends, etc. These labels are critical for training machine learning models because they provide the system with the necessary supervision information to help the model learn how to distinguish between normal textiles and various specific types of defects. In this way, the system can accurately identify and classify new textile images in practical applications, thereby improving the efficiency and accuracy of production quality control. This labeling method also supports the model to conduct in-depth learning and understanding, so that it can quickly and accurately evaluate the status of textiles in actual operations.
[0038] By learning the signatures of both defective and non-defective image blocks, the Bayesian classifier can more fully understand the characteristics of the data and make more accurate judgments in practical applications. Obtaining this kind of dataset can ensure that subsequent classifiers can perform well in a variety of situations, reduce false positives, and improve the accuracy of product quality control.
[0039] S2: Perform Laplacian pyramid decomposition and directional filter decomposition on the textile image in sequence to extract the sub-band information of the textile image.
[0040] The textile image sub-band information includes frequency information and direction information corresponding to the frequency information.
[0041] Among them, Laplacian pyramid decomposition is an image processing technique that creates a series of image layers by reducing the image resolution layer by layer, each layer representing a different frequency and detail level of the original image. Directional filter decomposition is another image processing method used to analyze the directional features in an image. By applying filters in different directions, the image is decomposed into multiple directional sub-bands. Sub-band information includes frequency and directional feature information extracted from the image, which refers to the collection of local frequency and directional responses obtained from the original image through these processing techniques.
[0042] Through Laplacian pyramid and directional filter decomposition, more detailed textile texture and structural information can be captured from different scales and directions, significantly improving the efficiency and accuracy of textile defect detection. This not only helps to identify various complex defect types, but also enhances the adaptability and accuracy of the model when processing various textile images. In addition, this multi-scale and multi-directional information extraction strategy is particularly important for understanding the specific damage and wear patterns of textiles, making defect detection more comprehensive and systematic.
[0043] In a possible implementation, S2 specifically includes:
[0044] S201: Calculate the texture complexity score of the textile image based on the jump frequency of the gray value:
[0045]
[0046] in, represents the jump frequency of the gray value representing the texture complexity score, Indicates i Line j Column coordinates ( i , j )The grayscale value of the pixel.
[0047] Among them, the larger the texture complexity score value, the more frequent the texture changes in the image and the higher the texture complexity. On the contrary, if this value is small, it means that the texture of the image is relatively smooth or uniform, and the texture changes are not frequent. Texture complexity reflects the richness of details in the image area. High-complexity textures (such as dense patterns or frequent color changes) require more sophisticated filtering to maintain details. For complex textures, the color intensity difference parameter of the bilateral filter should be set higher to avoid smoothing out important texture details. At the same time, the spatial width parameter should also be adjusted appropriately to adapt to local changes in texture.
[0048] S202: Perform bilateral filtering on the textile image in combination with the texture complexity score.
[0049] It should be noted that the initial image is subjected to bilateral filtering. This filter can preserve the edges while smoothing the image and is suitable for environments with more noise. The parameters of the bilateral filter will be automatically adjusted according to the image features to adapt to the characteristics of different regions.
[0050] In a possible implementation, S202 specifically includes:
[0051] S202A: Selecting a color intensity difference parameter of the bilateral filter in direct proportion to the texture complexity score, and selecting a spatial width parameter of the bilateral filter in inverse proportion to the texture complexity score:
[0052]
[0053] in, represents the color intensity difference parameter, represents the first adjustment coefficient, represents the space width parameter, represents the second adjustment coefficient, and log represents the logarithmic function.
[0054] Among them, the color intensity difference parameter controls the sensitivity of the filter to the difference in pixel values (color, intensity). It defines a threshold that determines which pixels have color differences small enough to be considered similar, so that they can be merged during the filtering process to smooth the image. The spatial width parameter controls the spatial range of the filter, that is, determines the spatial distance threshold between a pixel and its neighboring pixels. It defines the size of the neighborhood that should be considered when calculating the filter output of the current pixel. By adjusting these two parameters, the bilateral filter can adapt to different image processing requirements very flexibly and effectively balance the noise suppression and detail retention of the image.
[0055] The first adjustment coefficient can be adjusted according to the grayscale jump range of the actual image data. The logarithmic function is used to ensure that even when the texture complexity is very high, the growth of the color intensity difference parameter will not be too large, thereby avoiding excessive retention of noise. Specifically, the minimum value of the first adjustment coefficient can be set in the range of 5 to 10, which is suitable for scenes that require high sensitivity to retain details. The maximum value can be set in the range of 50 to 100, which is suitable for scenes with more image noise and a stronger smoothing effect. Generally speaking, a starting trial value can be 25, which is adjusted according to the processing effect of the actual image. The second adjustment coefficient can be adjusted according to specific application requirements and image characteristics. The square root function is used to control the reduction speed of the spatial width parameter to prevent the spatial width parameter from being too small for low-complexity images, resulting in loss of details. Specifically, the minimum value can start from 1, which is suitable for images that need to maintain high local details, and the maximum value can be set in the range of 10 to 20, which is used for stronger smoothing effects, especially in areas where the image texture changes are not very drastic. The starting value can be 5, which is adjusted to the most suitable level according to the processing effect. In actual application, the best combination value of the first adjustment coefficient and the second adjustment coefficient can be determined by improved grid search.
[0056] Specifically, the sum of the edge response and the noise level is used as the search target, where the edge response sum is calculated using the Canny algorithm and the noise variance is used to measure the noise. Then the search range is set and the initial search step is determined. Each pair of combinations is traversed, the objective function of each set of parameters is calculated, the results are recorded, and the initial optimal solution is found. Based on the optimal area obtained by the initial search, the genetic algorithm is used to further search for the optimal adjustment coefficient. The genetic algorithm explores the parameter space and finds a better solution by simulating the process of natural selection, such as crossover and mutation.
[0057] S202B: Calculate the neighborhood pixel points in the textile image according to the color intensity difference parameter and the space width parameter ( k , l ) for the center pixel ( i , j ) is the influence weight value of the pixel to be updated:
[0058]
[0059] in, represents the impact weight value, Represents the gray value, and exp represents the exponential function.
[0060] S202C: Update the central pixel point in the form of bilateral filtering based on the influence weight value:
[0061]
[0062] in, Represents the gray value of the updated central pixel, S The neighborhood of the central pixel is represented by the set of neighborhood pixels.
[0063] It should be noted that the texture complexity is measured by the jump frequency of the gray value, and the color intensity difference parameter and spatial width parameter of the bilateral filter are adjusted according to the texture complexity score, which can effectively adapt to the local characteristics of the image. The color intensity difference parameter directly affects the sensitivity of the filter to color differences, thereby controlling the degree of smoothness between visually similar pixels, while the spatial width parameter determines the range of the filter's influence, ensuring that noise is reduced while maintaining details. In this way, the bilateral filter can be adaptively adjusted in different texture areas and process the image more finely, so that the subsequent steps can more accurately identify and classify the types of defects in textiles. This process not only improves the accuracy of defect detection, but also optimizes the image processing process, making defect detection more efficient and reliable.
[0064] S203: Downsampling the bilaterally filtered textile image multiple times to obtain multiple layers of Laplacian pyramids including different frequency information, wherein each layer of the Laplacian pyramid is the frequency information difference before and after downsampling, and the initial layer of the Laplacian pyramid is the bilaterally filtered textile image.
[0065] S204: Extract frequency information of each layer of the Laplacian pyramid.
[0066] Specifically, frequency information can be quickly extracted through Fourier transform or wavelet transform.
[0067] S205: extracting directional information from each layer of the Laplacian pyramid in multiple extraction directions using a directional filter, wherein a preset angle is provided between each two adjacent extraction directions:
[0068]
[0069] in, Indicates the extraction direction θ The response result is the direction information, represents the first i layer, represents the convolution operation, Indicates the extraction direction θ Directional filter kernel.
[0070] It should be noted that those skilled in the art can set the size of the preset angle according to actual needs, and the present invention is not limited here. Specifically, it can be set to 15°, and finally covers the 360° full circumference range of the entire layer of the Laplace pyramid.
[0071] Specifically, by calculating the texture complexity score, the system is able to quantify the degree of texture variation in the image, which helps to more accurately adjust the filter parameters in the subsequent processing process to match texture features of different complexities. Next, the application of bilateral filtering can smooth the noise of textile images while retaining edge information, improving the usability of the image. Multi-level Laplacian pyramid downsampling and extraction of frequency information further enrich the expression of the data, allowing the system to capture a wide range of features from low frequency to high frequency, which is crucial for detecting subtle texture defects. Finally, by extracting directional information at multiple angles through directional filters, the system is able to analyze the structure of textiles from multiple dimensions, greatly improving the accuracy and efficiency of defect detection based on this data.
[0072] S3: Extracting descriptive parameters of sub-band information of textile images via a generalized Gaussian mixture model with multiple Gaussian components.
[0073] The description parameters include mean, standard deviation and mixing weight, and the description parameters are the same as the labels of textile images.
[0074] Among them, the generalized Gaussian mixture model is a statistical model used to capture multimodal distributions in data. This model describes the probability distribution of the overall data by combining multiple Gaussian distributions (each distribution is called a component), each with its own mean, standard deviation, and mixture weight. The descriptive parameters are the parameters of these Gaussian distributions, which characterize the statistical characteristics of the data in different subsets. The generalized Gaussian mixture model can adapt to data distributions of different shapes (such as peaked or flat distributions), which is particularly important for processing complex texture changes in textile images. Mean: The mean of each component represents the center of the distribution, that is, the average intensity of the coefficient of the subband. Standard deviation: represents the width of the distribution, that is, the variation or dispersion of the subband coefficients. Mixture weight: The weight of each distribution component, indicating the relative importance of the distribution in the entire mixture.
[0075] It should be noted that in textile defect detection, the use of generalized Gaussian mixture models to extract sub-band information can describe in detail the different characteristics of textile images, such as texture details and degree of variation. By accurately modeling the statistical distribution of textile image data, it can effectively distinguish between normal and defective states, thereby improving the accuracy and reliability of defect detection. In addition, because the model can automatically learn and adapt to new defect types, this method can also optimize the defect detection process, improve processing speed and efficiency, and thus achieve more dynamic and flexible quality control on the production line.
[0076] In a possible implementation, S3 specifically includes:
[0077] S301: Establishing a feature vector of the textile image based on frequency information and direction information:
[0078]
[0079] in, The first n feature vectors, n = m × o ,in, o Indicates the total number of extracted directions, represents the first i The frequency information of the layer, Indicates that from the Laplace pyramid i The collection of directional information extracted by the layer.
[0080] S302: Using an expectation maximization algorithm, the feature vector is used as a training set to train a generalized Gaussian mixture model.
[0081] Specifically, the feature vector of each textile image is constructed based on the obtained frequency information and direction information, which is a crucial step in textile defect detection. The construction of the feature vector allows the system to capture the characteristics of each textile image at different frequencies and directions, and convert complex image data into a format that is more suitable for processing by machine learning algorithms. Each feature vector here consists of the frequency information of each layer of the Laplacian pyramid and the response set in each direction, which fully captures the texture and structure information of the image. Then, the expectation maximization algorithm is used to train a generalized Gaussian mixture model, which can effectively handle a variety of different data distributions and find the best model parameters through an iterative optimization process to ensure that the model has a high recognition and classification accuracy for unseen textile images. This method not only improves the accuracy of defect detection, but also enhances the generalization ability of the model when facing diverse textile images.
[0082] In a possible implementation, S302 specifically includes:
[0083] S302A: Calculate the n The data point is n The eigenvectors come from the posterior probability of each Gaussian component:
[0084]
[0085] in, Indicates n The data points come from k The posterior probability of the Gaussian components is K represents the total number of Gaussian components, Indicatesk The mixture weights of Gaussian components, Indicates k The mean of the Gaussian components, Indicates k The covariance matrix of the Gaussian components, Indicates that in a given k Gaussian components, the observed data points The probability of represents the normalization factor, ensuring K Gaussian components for data points The weighted sum of is 1.
[0086] It should be noted that by calculating the posterior probability, the parameters (mean, covariance) of each Gaussian component and the mixing weight are continuously adjusted during the iteration process to maximize the log-likelihood of the entire data set. This calculation reflects the degree of association between each data point and each Gaussian component, and is used to re-estimate the component parameters in the maximization step, thereby fine-tuning the model to better fit the data.
[0087] S302B: Update the description parameters of each Gaussian component according to the posterior probability:
[0088]
[0089] in, N Represents the total number of data points.
[0090] S302C: Change the data point and repeat S302A-S302B until n The data points are calculated.
[0091] S302D: Extracting descriptive parameters from trained generalized Gaussian mixture models.
[0092] Specifically, first, in stage S302A, the posterior probability of each eigenvector coming from different Gaussian components is calculated, which not only indicates the probability of belonging to the Gaussian component corresponding to each data point, but also reflects the degree of fit between the data and the model. This step uses the expectation maximization algorithm, and continuously updates the mixed weights, mean and covariance parameters of the model by alternating the expectation step and the maximization step to improve the model's ability to interpret the data. In S302B, the parameters of the Gaussian component are updated based on the calculated posterior probability. This optimization process ensures that the model can reflect the true distribution characteristics of the data to the greatest extent. The whole process is repeated until all data points are covered, and finally in S302D, the key descriptive parameters are extracted from the optimized model, which will be used for further classification and defect detection tasks. This processing method enables the model to find the best data representation in complex textile image data, thereby achieving efficient and accurate defect detection in practical applications.
[0093] In a possible implementation, the description parameters further include shape parameter, skewness, kurtosis, energy, entropy, contrast and correlation.
[0094] Shape parameter: controls the shape of the distribution, affecting the sharpness and flatness of the data. This is an extension of the standard Gaussian distribution, allowing the model to capture a wider range of natural distribution characteristics. Skewness describes the asymmetry of the data distribution. In textile images, skewness can help identify the bias in the distribution of image pixel values, which may be due to a specific type of defect. Kurtosis indicates the sharpness of the data distribution. A distribution with higher kurtosis may indicate the presence of sharp or prominent features in the image, which is typical for certain types of textile defects such as cracks or scratches. Energy can be calculated from the energy or power of each subband. It is the sum of the squares of the pixel values. In textile image analysis, energy features can reflect the roughness or smoothness of the texture. Entropy represents the information content of the image. High entropy usually refers to an image with a high degree of complexity or variation. In defect detection, changes in entropy can reveal abnormalities in texture and structure in image areas. Contrast represents the difference between the brightest and darkest parts of the image. Contrast is very important in textile defect detection because it can help distinguish defective areas from normal areas in the image. Correlation measures the relationship between pixels in an image. Correlation parameters can be used to analyze texture orientation and alignment in textile images, which can be very noticeable in certain defect types.
[0095] Reference Manual Attached Figure 2 , shows a schematic diagram of the structure of an enhanced Bayesian classifier provided in an embodiment of the present invention.
[0096] Figure 2 In the example, the number of class variable nodes, i.e., labels, is multiple, i.e. nclass variable node, the final classification results of multiple descriptive parameters will point to the label corresponding to the class variable node, that is, normal or some kind of defect. In this process, the descriptive parameters also affect each other. The influence relationship between them is represented by dotted lines and arrows. CPT represents the conditional probability table of each node. In this process, the relationship between nodes and nodes and labels is considered, that is, when considering the classification of descriptive parameters to a certain label, the interaction relationship between descriptive parameters is also considered, instead of the traditional independent consideration of the relationship between a variable and a label. This mining-based classifier establishment method can effectively capture the correlation between each descriptive parameter and the interaction relationship between the predicted labels, so that the classifier can learn more and more accurate classification relationships, and improve the classification accuracy and generalization ability of the classifier in actual use.
[0097] S4: Combine the hidden relationships between description parameters to construct an enhanced Bayesian classifier.
[0098] Among them, the enhanced Bayesian classifier includes nodes, class variable nodes and directed edges, wherein each node corresponds to a description parameter, the class variable node is the label corresponding to the description parameter, and the directed edge represents the association relationship between each description parameter and between each description parameter and the class variable node.
[0099] Among them, the Bayesian classifier is a statistical method based on Bayes' theorem for classification tasks. It calculates the posterior probability of each category, that is, the probability of belonging to a certain category given the input data, and makes decisions based on these probabilities.
[0100] It should be noted that most of the existing Bayesian classifiers are based on the independence assumption, that is, all features are independent of each other. In practical applications, especially in the field of image processing, there is often a certain correlation between features. For example, the texture features of textiles may be correlated with each other at different scales and directions. The simplification of this assumption may affect the accuracy of the model. The constructed enhanced Bayesian classifier can capture the potential dependencies between various descriptive parameters, namely the mean, standard deviation, shape parameters and mixing weights, and then in the training process, it can find more accurate potential relationships between various descriptive parameters and whether defects occur and what defect categories they are. It can effectively improve the accuracy and generalization ability of the classifier in practical applications, better understand and utilize the complex feature relationships in image data, thereby improving the accuracy and reliability of classification, and overcoming the limitations of naive Bayes due to ignoring feature correlation.
[0101] S5: The description parameters of each textile image and the labels corresponding to the description parameters are used to form a training set to train the enhanced Bayesian classifier, construct an enhanced Bayesian classifier with complete directed edges and generate the conditional probability of each node in the enhanced Bayesian classifier.
[0102] The conditional probability table describes the probability of predicting other parameters or categories when certain parameter values are known.
[0103] Specifically, a dataset for training is constructed by collecting the descriptive parameters (mean, standard deviation, and mixing weight) of each textile image and its corresponding labels (normal or specific defect type). These descriptive parameters and labels are the basis for training the enhanced Bayesian classifier, enabling it to learn and understand the characteristics of different textile defects. The enhanced Bayesian classifier expresses the dependencies between descriptive parameters and between descriptive parameters and class variable nodes (labels) through directed edges, which are reflected in the conditional probability table in the model. In this way, the classifier can not only identify and classify textile defects more accurately, but also understand how these defects manifest themselves from the statistical characteristics of the data. This approach improves the prediction accuracy and generalization ability of the model, making it more effective and reliable in practical applications, especially when faced with diverse and complex textile defects.
[0104] In a possible implementation, S5 specifically includes:
[0105] S501: Take the description parameters and the labels corresponding to the description parameters as variables, and calculate the mutual information value between the two variables:
[0106]
[0107] in, represents the mutual information value between variable A and variable B, Indicates that the value of variable A is a and variable B takes the value b The joint probability of the case is Representation variables a and variables b The marginal probability between .
[0108] Among them, mutual information is a statistic that measures the amount of shared information between two variables, which measures how much the information of one variable reduces the uncertainty about another variable. If two variables are completely independent, their mutual information is zero. If two variables are completely correlated, their mutual information is equal to their respective entropies. When constructing a Bayesian network, mutual information can be used to determine how nodes (variables) in the network are connected. Specifically, by calculating the mutual information between descriptive parameters and between descriptive parameters and defect types, it can be determined which variables should be directly connected, thereby effectively capturing the dependencies in the data.
[0109] Specifically, joint probability is the probability of two (or more) events occurring at the same time. For example, if we want to calculate the probability of describing the parameters mean high and standard deviation low occurring at the same time, we use joint probability. Marginal probability is the probability of focusing on a single variable in a multivariate probability distribution, without considering the influence of other variables.
[0110] S502: Connect two variables whose mutual information values are greater than a preset mutual information value to obtain an enhanced Bayesian classifier with complete directed edges.
[0111] It should be noted that those skilled in the art can set the size of the preset mutual information value according to actual needs, and the present invention is not limited here.
[0112] S503: Calculate the conditional probability of each node and generate a conditional probability table of the enhanced Bayesian classifier, wherein the conditional probability reflects the dependency relationship between the variables:
[0113]
[0114] in, Indicates that at a known node e The parent node set is the predecessor node set In the case of e The conditional probability of taking a specific value, Represents the nodes in the training set e The number of samples that take a specific value simultaneously in conjunction with the corresponding predecessor node, Represents the nodes in the training set e The number of samples that the predecessor node takes a specific value.
[0115] It should be noted that by calculating the mutual information between the descriptive parameters and the corresponding labels, the system can identify and quantify the dependencies between these variables. The calculation of mutual information helps determine which parameters have significant information sharing, which is the key to building an effective enhanced Bayesian classifier. The variable pairs with mutual information values higher than the preset threshold are connected to form the directed edges of the network, which ensures that the classifier only considers the most informative associations in the model. After completing this process, the obtained data is used to generate a conditional probability table, which contains not only the independent probability distribution of each variable, but also the conditional probability of each node when the predecessor node is given. These conditional probability tables are the basis for Bayesian networks to make predictions and decisions. They reflect in detail the mutual dependence between the descriptive parameters and between the parameters and the defect type, enhance the classifier's prediction accuracy for new data, enable it to better identify and classify various textile defects in practical applications, integrate the complex relationship between multiple variables, and improve the overall performance of textile defect detection through accurate mathematical models.
[0116] S6: Acquire the fabric image to be detected.
[0117] S7: Generate description parameters of the fabric image to be detected.
[0118] S8: Input the description parameters of the fabric image to be detected into the trained enhanced Bayesian classifier, and output the defect type of the fabric image to be detected.
[0119] Specifically, first, the fabric images to be tested are obtained. These images are actual samples that are not labeled and need to be identified whether they contain defects. Then, the same image processing operations are performed on these images to be tested, such as Laplacian pyramid decomposition and directional filter decomposition performed on the previous training data set, to extract key description parameters such as mean, standard deviation and mixing weight. These description parameters capture the core features and statistical information of the image. Finally, these description parameters are input into the trained enhanced Bayesian classifier. Based on the input parameters, the classifier uses its internal conditional probability table and node dependencies to accurately predict the defect type of each image to be tested. This process is not only fast but also accurate, which greatly improves the quality control efficiency in the textile production process and ensures the consistency and reliability of product quality.
[0120] In a possible implementation manner, after S8, the method further includes:
[0121] At preset intervals, the textile image set is updated and the enhanced Bayes classifier is retrained.
[0122] Understandably, by regularly updating the set of textile images and retraining the enhanced Bayesian classifier, the system is able to learn the latest textile defect patterns and trends, thereby improving its accuracy in identifying and classifying defects.
[0123] The beneficial effects brought about by the technical solution provided by the embodiment of the present invention include at least:
[0124] In the present invention, the frequency and directional information of the textile image are analyzed in detail through Laplacian pyramid and directional filter decomposition, and the subtle defects on the fabric surface are captured. Then, the generalized Gaussian mixture model is used to extract the key descriptive parameters that can comprehensively reflect the state and characteristics of the textile, namely the mean, standard deviation and mixing weight. Then, the relationship between these descriptive parameters is learned, not only the independent characteristics of the parameters are learned, but also the association between the parameters are learned, so as to more accurately distinguish the defect type, and then a more sophisticated decision network, namely the enhanced Bayesian classifier, is constructed, so that the final defect recognition not only depends on a single image feature, but is based on a comprehensive analysis of multiple dimensions, which can effectively improve the generalization ability of the classifier, significantly improve the accuracy of defect detection, reduce the misjudgment rate, and at the same time improve the processing speed, so that the quality control of batch textiles is more efficient and reliable. This textile defect detection based on machine vision can make up for the problem of high cost and low efficiency of manual detection in the traditional textile defect detection process, optimize the textile production process, reduce costs and increase efficiency, and enhance product competitiveness.
[0125] Reference Manual Attached Figure 3 , showing a structural schematic diagram of a textile defect detection system based on machine vision provided by the present invention.
[0126] The present invention further provides a textile defect detection system 20 based on machine vision, which is applied to the above-mentioned textile defect detection method based on machine vision, comprising:
[0127] Processor 201.
[0128] The memory 202 stores computer-readable instructions. When the computer-readable instructions are executed by the processor 201, the method for detecting textile defects based on machine vision in the method embodiment is implemented.
[0129] The machine vision-based textile defect detection system 20 provided in the present invention can execute the above-mentioned machine vision-based textile defect detection method and achieve the same or similar technical effects. To avoid repetition, the present invention will not go into details.
[0130] The beneficial effects brought about by the technical solution provided by the embodiment of the present invention include at least:
[0131] In the present invention, the frequency and directional information of the textile image are analyzed in detail through Laplacian pyramid and directional filter decomposition, and the subtle defects on the fabric surface are captured. Then, the generalized Gaussian mixture model is used to extract the key descriptive parameters that can comprehensively reflect the state and characteristics of the textile, namely the mean, standard deviation and mixing weight. Then, the relationship between these descriptive parameters is learned, not only the independent characteristics of the parameters are learned, but also the association between the parameters are learned, so as to more accurately distinguish the defect type, and then a more sophisticated decision network, namely the enhanced Bayesian classifier, is constructed, so that the final defect recognition not only depends on a single image feature, but is based on a comprehensive analysis of multiple dimensions, which can effectively improve the generalization ability of the classifier, significantly improve the accuracy of defect detection, reduce the misjudgment rate, and at the same time improve the processing speed, so that the quality control of batch textiles is more efficient and reliable. This textile defect detection based on machine vision can make up for the problem of high cost and low efficiency of manual detection in the traditional textile defect detection process, optimize the textile production process, reduce costs and increase efficiency, and enhance product competitiveness.
[0132] It should be understood that the processor in the embodiment of the present invention may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0133] It should also be understood that the memory in the embodiments of the present invention may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct rambus RAM (DR RAM).
[0134] The above embodiments can be implemented in whole or in part by software, hardware (such as circuits), firmware or any other combination. When implemented by software, the above embodiments can be implemented in whole or in part in the form of 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, the process or function described in the embodiment of the present invention is generated in whole or in part. 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 computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center by wired (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that contains one or more available media sets. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a tape), an optical medium (for example, a DVD), or a semiconductor medium. The semiconductor medium can be a solid-state hard disk.
[0135] It should be understood that the term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. A and B can be singular or plural. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship, but it may also indicate an "and / or" relationship. Please refer to the context for specific understanding.
[0136] In the present invention, "at least one" means one or more, and "plurality" means two or more. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.
[0137] It should be understood that in various embodiments of the present invention, the size of the serial numbers of the above-mentioned processes does not mean 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.
[0138] Those skilled in the art will appreciate that the units and algorithm steps of each example 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 performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0139] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described equipment, devices and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0140] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0141] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0142] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0143] If the functions are implemented in the form of 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 the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, and other media that can store program codes.
[0144] An embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein when the program is executed by a processor, the method for detecting textile defects based on machine vision as described in the method embodiment is implemented.
[0145] A computer-readable storage medium provided by the present invention can implement the steps and effects of the textile defect detection method based on machine vision in the above method embodiment. To avoid repetition, the present invention will not go into details.
[0146] The beneficial effects brought about by the technical solution provided by the embodiment of the present invention include at least:
[0147] In the present invention, the frequency and directional information of the textile image are analyzed in detail through Laplacian pyramid and directional filter decomposition, and the subtle defects on the fabric surface are captured. Then, the generalized Gaussian mixture model is used to extract the key descriptive parameters that can comprehensively reflect the state and characteristics of the textile, namely the mean, standard deviation and mixing weight. Then, the relationship between these descriptive parameters is learned, not only the independent characteristics of the parameters are learned, but also the association between the parameters are learned, so as to more accurately distinguish the defect type, and then a more sophisticated decision network, namely the enhanced Bayesian classifier, is constructed, so that the final defect recognition not only depends on a single image feature, but is based on a comprehensive analysis of multiple dimensions, which can effectively improve the generalization ability of the classifier, significantly improve the accuracy of defect detection, reduce the misjudgment rate, and at the same time improve the processing speed, so that the quality control of batch textiles is more efficient and reliable. This textile defect detection based on machine vision can make up for the problem of high cost and low efficiency of manual detection in the traditional textile defect detection process, optimize the textile production process, reduce costs and increase efficiency, and enhance product competitiveness.
[0148] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
[0149] There are a few points to note:
[0150] (1) The drawings of the embodiments of the present invention only involve structures related to the embodiments of the present invention. Other structures may refer to conventional designs.
[0151] (2) For the sake of clarity, in the drawings used to describe the embodiments of the present invention, the thickness of layers or regions is exaggerated or reduced, that is, these drawings are not drawn according to the actual scale. It is understood that when an element such as a layer, film, region or substrate is referred to as being "on" or "under" another element, the element may be "directly" "on" or "under" the other element or there may be intermediate elements.
[0152] (3) In the absence of conflict, the embodiments of the present invention and the features therein may be combined with each other to obtain new embodiments.
[0153] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. The protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A method for detecting textile defects based on machine vision, characterized in that: include: S1: Acquire a textile image set, wherein the textile image set includes textile images with normal labels and labels of different defect categories; S2: performing Laplacian pyramid decomposition and directional filter decomposition on the textile image in sequence to extract subband information of the textile image, wherein the subband information of the textile image includes frequency information and direction information corresponding to the frequency information; S3: extracting description parameters of the subband information of the textile image through a generalized Gaussian mixture model having multiple Gaussian components, wherein the description parameters include a mean, a standard deviation, and a mixture weight, and the description parameters are the same as the label of the textile image; S4: combining the hidden relationship between the description parameters, constructing an enhanced Bayesian classifier, wherein the enhanced Bayesian classifier includes nodes, class variable nodes and directed edges, wherein each node corresponds to a description parameter, the class variable node is a label corresponding to the description parameter, and the directed edge represents the association relationship between each description parameter and between each description parameter and the class variable node; S5: The description parameters of each textile image and the labels corresponding to the description parameters are used as a training set to train the enhanced Bayesian classifier, construct an enhanced Bayesian classifier with complete directed edges and generate conditional probabilities of each node in the enhanced Bayesian classifier; S6: Acquire the fabric image to be detected; S7: generating description parameters of the fabric image to be detected; S8: inputting the description parameters of the fabric image to be detected into the trained enhanced Bayesian classifier, and outputting the defect type of the fabric image to be detected; Wherein, the S2 specifically includes: S201: Calculating the texture complexity score of the textile image based on the jump frequency of the gray value: in, represents the jump frequency of the gray value representing the texture complexity score, Indicates i Line j Column coordinates ( i , j ) The gray value of the pixel; S202: performing bilateral filtering on the textile image in combination with the texture complexity score; S203: performing multiple downsampling on the bilaterally filtered textile image to obtain multiple layers of Laplacian pyramids including different frequency information, wherein each layer of the Laplacian pyramid is a frequency information difference before and after downsampling, and an initial layer of the Laplacian pyramid is the bilaterally filtered textile image; S204: extracting frequency information of each layer of the Laplacian pyramid; S205: extracting the directional information in multiple extraction directions from each layer of the Laplacian pyramid through the directional filter, wherein a preset angle is spaced between every two adjacent extraction directions: in, Indicates the extraction direction θ The response result is the direction information, represents the first i layer, represents the convolution operation, Indicates the extraction direction θ Directional filter kernel; Wherein, the S202 specifically includes: S202A: Selecting a color intensity difference parameter of the bilateral filter in direct proportion to the texture complexity score, and selecting a spatial width parameter of the bilateral filter in inverse proportion to the texture complexity score: in, represents the color intensity difference parameter, represents the first adjustment coefficient, represents the space width parameter, represents the second adjustment coefficient, log represents the logarithmic function; S202B: Calculate the neighborhood pixel points ( k , l ) for the center pixel ( i , j ) is the influence weight value of the pixel to be updated: in, represents the impact weight value, Represents grayscale value, exp represents exponential function; S202C: Update the central pixel point in a bilateral filtering manner based on the influence weight value: in, Represents the gray value of the updated central pixel, S The neighborhood of the central pixel is represented by the set of neighborhood pixels.
2. The method for detecting textile defects based on machine vision according to claim 1, characterized in that: The S3 specifically includes: S301: Establishing a feature vector of the textile image based on the frequency information and the direction information: in, The textile image is represented by n feature vectors, n = m × o ,in, o Indicates the total number of extracted directions, represents the first i The frequency information of the layer, , Indicates that from the Laplace pyramid i The collection of directional information extracted by the layer; S302: Using an expectation maximization algorithm, the feature vector is used as a training set to train the generalized Gaussian mixture model.
3. The method for detecting textile defects based on machine vision according to claim 1, characterized in that: The S302 specifically includes: S302A: Calculate the n The data point is n The eigenvectors come from the posterior probability of each Gaussian component: in, Indicates n The data points come from k The posterior probability of the Gaussian components is K represents the total number of Gaussian components, Indicates k The mixture weights of Gaussian components, Indicates k The mean of the Gaussian components, Indicates k The covariance matrix of the Gaussian components, Indicates that in a given k Gaussian components, the observed data points The probability of represents the normalization factor, ensuring K Gaussian components for data points The weighted sum of is 1; S302B: Update the description parameters of each Gaussian component according to the posterior probability: in, N Indicates the total amount of data points; S302C: Change the data point and repeat S302A-S302B until n Data points calculated; S302D: Extract the description parameters from the trained generalized Gaussian mixture model.
4. The method for detecting textile defects based on machine vision according to claim 1, characterized in that: The descriptive parameters also include shape parameters, skewness, kurtosis, energy, entropy, contrast and correlation.
5. The method for detecting textile defects based on machine vision according to claim 1, characterized in that: The S5 specifically includes: S501: The description parameters and the labels corresponding to the description parameters are taken as variables, and the mutual information values between the two variables are calculated: in, represents the mutual information value between variable A and variable B, Indicates that the value of variable A is a and variable B takes the value b The joint probability of the case is Representation variables a and variables b The marginal probability between S502: Connect two variables whose mutual information values are greater than a preset mutual information value to obtain an enhanced Bayesian classifier with complete directed edges; S503: Calculate the conditional probability of each node and generate a conditional probability table of the enhanced Bayesian classifier, wherein the conditional probability reflects the dependency relationship between various variables: in, Indicates that at a known node e The parent node set is the predecessor node set In the case of e The conditional probability of taking a specific value, Represents the nodes in the training set e The number of samples that take a specific value simultaneously in conjunction with the corresponding predecessor node, Represents the nodes in the training set e The number of samples that the predecessor node takes a specific value.
6. The method for detecting textile defects based on machine vision according to claim 1, characterized in that: After S8, the method further includes: At preset time intervals, the textile image set is updated and the enhanced Bayesian classifier is retrained.
7. A textile defect detection system based on machine vision, characterized in that: include: processor; A memory having computer-readable instructions stored thereon, wherein when the computer-readable instructions are executed by the processor, the method for detecting textile defects based on machine vision according to any one of claims 1 to 6 is implemented.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method for detecting textile defects based on machine vision as claimed in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
HRCT peripheral nerve cutting based on KECA feature dimension reduction and clustering
CN105512670A
Screen photography image moire removing method based on multichannel decomposition
CN108154487A