Textile yarn cake forming defect detection method based on extended local binary pattern
Through the detection method of poor defects of textile silk cake molding based on extended local binary mode, the texture feature extraction is performed using image segmentation and extended LBP algorithm, and the classification is combined with SVM, the problem of low detection efficiency and accuracy in the existing technology is solved, and automatic detection with high accuracy is achieved.
Patent Information
- Application Number
- CN202210080786.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-24
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2042-01-24
AI Technical Summary
The prior art has problems of low production efficiency, low accuracy and high labor costs in the detection of poor molding of textile silk cakes, making it difficult to achieve high accuracy, efficient and real-time detection.
The textile silk cake molding defect detection method based on extended local binary mode (LBP) is adopted, and texture feature extraction and classification is achieved through image segmentation, affine transformation, data set division, extended LBP algorithm and support vector machine (SVM) to achieve automatic detection.
The production efficiency and product quality of textile silk cake defect detection are improved, and high-accuracy automated inspection is achieved, avoiding the shortcomings of manual inspection.
Smart Images

Figure CN114511527B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of 2D industrial image processing, and in particular to a method for detecting textile yarn cake forming defects based on extended local binary patterns. Background Art
[0002] Textiles are ubiquitous in our daily lives. As a major agricultural nation, my country has been a major producer of silk and other textiles since ancient times. Silk cakes, due to their high strength, wear resistance, low density, and excellent elasticity, have become a crucial textile raw material. Made from filament yarn packages, they are widely used in textiles, clothing, and architectural interiors, as well as in defense, aerospace, biomedical materials, and energy development. The quality of silk cakes significantly impacts the quality of textiles. Defect detection of silk cakes on industrial production lines is primarily performed manually, but this method is subject to significant human influence, resulting in low production efficiency and accuracy. High and increasing labor costs have created bottlenecks for the development of textile companies. Currently, professors and scholars at Chinese universities are still in the early stages of research on automated defect detection for textile products. While relevant papers and patents have been published, these findings are immature and remain confined to laboratory research and validation. There are three main approaches to detecting defects in yarn cakes from textile images. One approach involves using traditional machine learning feature extraction algorithms. These algorithms process images into datasets and then train them to generate feature vectors. These vectors are then combined with labels and machine learning classification methods to calculate accuracy. Finally, slider predictions are performed on the entire image to detect defects. However, there are numerous traditional machine learning feature extraction and classification methods, raising questions about how to select and expand them to achieve high accuracy. Furthermore, how can the learning process be optimized to avoid interference from imaging on industrial production lines? A second approach involves deep learning. A third approach involves using traditional image processing methods. While these methods are efficient and stable, they also have significant limitations.
[0003] Therefore, how to detect defects in textile yarn cake forming with high accuracy, high efficiency and real-time, and to use them in the production lines of some textile manufacturing enterprises in a timely manner has become a technical problem that needs to be solved urgently. Summary of the Invention
[0004] The object of the present invention is to provide a method for detecting poorly formed defects in textile yarn cakes based on extended local binary patterns, which can not only successfully realize automated defect detection of textile yarn cakes, but also greatly improve the production efficiency and product quality of textile yarn cake defect detection.
[0005] To achieve the above-mentioned object, the present invention adopts the following technical solution: a method for detecting defects in textile yarn cake forming based on extended local binary patterns, the method comprising the following steps in order:
[0006] (1) Obtaining silk cake images and downsampling: Read all silk cake images in the folder and reduce the length and width of the silk cake images to the same size;
[0007] (2) Image segmentation and image cropping: After image segmentation, the reduced silk cake image is subjected to background interference removal to extract the desired image; the extracted desired image is cropped and cut into images of the same size;
[0008] (3) Perform affine transformation: flip the cut image horizontally, vertically, and horizontally and vertically;
[0009] (4) Obtaining a data set: The normal images in the images after affine transformation are defined as positive samples, and the images with poor shaping are defined as negative samples. The positive samples and negative samples together constitute a data set, and the data set is divided into a training set and a test set in a ratio of 7:3;
[0010] (5) Calculate the texture feature vectors of each image in the training set by using the extended LBP algorithm: Calculate the texture feature vectors of the positive and negative sample images in the training set, and set the label of each positive sample image in the training set to 1, and the label of each negative sample image in the training set to -1;
[0011] (6) Use SVM support vector machine to train the texture feature vectors and labels of the positive sample and negative sample images in the training set to generate an XML file;
[0012] (7) The texture feature vector of each image in the test set is calculated by the extended LBP algorithm. The SVM support vector machine predicts the label of each image in the positive and negative samples of the test set and calculates the prediction accuracy.
[0013] (8) Slider prediction for the silk cake image to be detected: After downsampling the silk cake image to be detected, the desired image is cut out. Then, a slider of the same size as the image in the dataset is placed at the upper left corner of the cut-out desired image. The slider is then slid from top to bottom and from left to right. When the slider is in each area of the desired image, the texture feature vector of the image area where the slider is located is calculated using the extended LBP algorithm, and the label of the image area is predicted using the SVM support vector machine.
[0014] (9) Outputting the judgment result based on the label predicted by the slider: The type of the silk cake image to be detected is judged based on the predicted label. If the number of labels with a value of -1 is greater than 10, the silk cake image to be detected is judged to be a poorly formed image. Conversely, if the number of labels with a value of -1 is less than 10, the silk cake image to be detected is judged to be a normal image.
[0015] In step (2), the image segmentation specifically includes the following steps:
[0016] (2a) For normal images and defective images, pixel transformation is performed: a pixel value is set. If it is greater than the range of this pixel value, the pixel is changed to 255, that is, it becomes white; if it is less than the range of this pixel value, the pixel is changed to 0, that is, it becomes black;
[0017] (2b) performing vertical projection on the pixel-transformed image;
[0018] (2c) obtaining the horizontal coordinate corresponding to the threshold value of the vertical coordinate being greater than 500 after the vertical projection;
[0019] (2d) Then obtain the maximum value x1 and the minimum value x2 of these horizontal coordinates, and the length of the original image is y. Cut the original image with the four vertices (x1,0)(x2,0)(x1,y)(x2,y) to obtain a rectangle with (x1,0)(x2,0)(x1,y)(x2,y) as the four vertices. This rectangular image is the image required after removing background interference.
[0020] In step (5), the extended LBP algorithm refers to: taking each pixel in the image as the central pixel point, and comparing it with the grayscale values of 8 pixels in the 3×3 neighborhood, if the surrounding pixel values are greater than the pixel value of the central pixel point, the position of the central pixel point is marked as 1, otherwise it is 0; the 8 points in the 3×3 neighborhood are compared to generate an 8-bit binary number, and the 8-bit binary number is arranged clockwise to form a binary number, and then the binary number is converted to decimal, and the decimal number is the LBP value of the central pixel point; the LBP value of each pixel in the image is calculated, and the decimal range of the calculated LBP value is [0, 255], and the frequency of the LBP value of each pixel appearing at each place on [0, 255] is counted to construct a histogram of the LBP value of the image, and the histogram is 256-dimensional, and then 3 dimensions are added to the 256-dimensional, and the 3 dimensions store the average pixel, maximum grayscale difference and average gradient of the entire image in turn. The histogram is normalized after it is changed from the original 256-dimensional to 259-dimensional;
[0021] The extended LBP algorithm is used to calculate the texture feature vectors of each image in the training set, which specifically includes the following steps:
[0022] (5a) Divide the detection window into 16×16 small areas on each 64×64 sample image in the training set;
[0023] (5b) Each pixel in the 16×16 small area is taken as the central pixel and compared with the grayscale values of the 8 pixels in the 3×3 neighborhood. If the surrounding pixel values are greater than the pixel value of the central pixel, the position of the central pixel is marked as 1, otherwise it is marked as 0. The 8 points in the 3×3 neighborhood are compared to generate an 8-bit binary number. These 8-bit binary numbers are arranged clockwise to form a binary number. The binary number is converted to decimal, and this decimal number is the LBP value of the central pixel.
[0024] (5c) Calculate the histogram of each small area, that is, the frequency of each number, and then add 3 dimensions to the 256-dimensional histogram of each small area to store the average pixel, maximum grayscale difference, and average gradient of each small area; then normalize the histogram;
[0025] (5d) The statistical histograms of each small area are connected to form a feature vector, that is, the feature vector is the texture feature vector of the 64×64 sample image obtained using the extended LBP algorithm.
[0026] The step (6) specifically includes the following steps:
[0027] (6a) The labels of the positive samples of the training set in the data set, i.e., normal images, are set to 1, and the labels of the negative samples of the training set in the data set, i.e., poorly formed images, are set to -1;
[0028] (6b) The LBP texture feature vectors, labels of positive samples, and labels of negative samples calculated in step (5) are input into the SVM support vector machine for training, and an XML file is generated. The file stores the texture feature vectors calculated from the positive samples and negative samples, as well as the labels corresponding to the positive samples and negative samples.
[0029] The step (7) specifically includes the following steps:
[0030] (7a) Read the XML file obtained in step (6);
[0031] (7b) Set the label of each positive sample image in the test set to 1 and the label of each negative sample image to -1;
[0032] (7c) Calculate the texture feature vectors of the positive and negative sample images in the test set;
[0033] (7d) For the positive samples in the test set, the SVM support vector machine predicts whether the label corresponding to each image of the positive samples in the test set is 1 or -1 based on the texture feature vector of the positive sample image calculated in step (7c) and the texture feature vector and label 1 of the positive sample image in the XML file read in step (7a); For the negative samples in the test set, the SVM support vector machine predicts whether the label corresponding to each image of the negative samples in the test set is 1 or -1 based on the texture feature vector of the negative sample image calculated in step (7c) and the texture feature vector and label -1 of the negative sample image in the XML file read in step (7a);
[0034] (7e) Compare the labels of the predicted positive and negative sample images in the test set with the labels set in step (7b) and calculate the prediction accuracy: if the predicted label is consistent with the label set in step (7b), the prediction is judged to be correct; if the predicted label is inconsistent with the label set in step (7b), the prediction is judged to be wrong; Accuracy = the total number of correct predictions divided by the total number of labels multiplied by 100%.
[0035] The step (8) specifically includes the following steps:
[0036] (8a) Define the size of the slider: the length and width of the slider are consistent with the length and width of the positive and negative samples in the dataset;
[0037] (8b) defining the step size of the slider in horizontal and vertical translation;
[0038] (8c) Moving the slider on the image at each step to extract texture features and obtain a texture feature vector;
[0039] (8d) predicting labels for the texture feature vectors obtained from the slider according to the XML file in step (6);
[0040] (8e) Count the predicted labels.
[0041] As can be seen from the above technical solution, the present invention has the following beneficial effects: First, the present invention removes the final background interference through image segmentation, so that the processed image no longer contains a large amount of interference. This solves the problem of moving from the research and verification stage in the laboratory to direct use in industrial production lines, thus enabling chemical fiber companies to avoid the series of shortcomings caused by manual detection of yarn cake defects in industrial production. Second, the present invention comprehensively considers the various background interferences caused by industrial production imaging of textile yarn cakes, as well as the characteristics and distribution of the background, thereby completely removing the background interference without affecting the useful foreground information in the original image. Furthermore, by using datasets of different sizes and different LBP feature extraction methods, the present invention successfully outputs normal and poorly formed textile yarn cakes. Third, the present invention has high accuracy and short detection time for poorly formed textile yarn cake defects. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 is a flow chart of the method of the present invention;
[0043] Figure 2(a) shows a normal image of a textile yarn cake;
[0044] Figure 2(b) shows an image of a textile yarn cake with poorly formed defects;
[0045] Figure 3(a) shows the normal textile silk cake image after image segmentation;
[0046] Figure 3(b) shows the image of a textile yarn cake with poor forming defects after image segmentation;
[0047] Figure 4(a) shows an image cropped to 64×64 positive samples;
[0048] Figure 4(b) shows the image cropped into 64×64 negative samples;
[0049] Figure 5 To predict the accuracy of the dataset using the extended LBP;
[0050] Figure 6 Use the slider to predict whether the entire image is a normal image or an image with poor molding defects. DETAILED DESCRIPTION
[0051] like Figure 1 As shown, a method for detecting defects in textile yarn cake forming based on extended local binary patterns includes the following steps in sequence:
[0052] (1) Obtaining silk cake images and downsampling: Read all silk cake images in the folder and reduce the length and width of the silk cake images to the same size;
[0053] (2) Image segmentation and image cropping: After image segmentation, the reduced silk cake image is subjected to background interference removal to extract the desired image; the extracted desired image is cropped and cut into images of the same size;
[0054] (3) Perform affine transformation: flip the cut image horizontally, vertically, and horizontally and vertically;
[0055] (4) Obtaining a data set: The normal images in the images after affine transformation are defined as positive samples, and the images with poor shaping are defined as negative samples. The positive samples and negative samples together constitute a data set, and the data set is divided into a training set and a test set in a ratio of 7:3;
[0056] (5) Calculate the texture feature vectors of each image in the training set by using the extended LBP algorithm: Calculate the texture feature vectors of the positive and negative sample images in the training set, and set the label of each positive sample image in the training set to 1, and the label of each negative sample image in the training set to -1;
[0057] (6) Use SVM support vector machine to train the texture feature vectors and labels of the positive sample and negative sample images in the training set to generate an XML file;
[0058] (7) The texture feature vector of each image in the test set is calculated by the extended LBP algorithm. The SVM support vector machine predicts the label of each image in the positive and negative samples of the test set and calculates the prediction accuracy.
[0059] (8) Slider prediction for the silk cake image to be detected: After downsampling the silk cake image to be detected, the desired image is cut out. Then, a slider of the same size as the image in the dataset is placed at the upper left corner of the cut-out desired image. The slider is then slid from top to bottom and from left to right. When the slider is in each area of the desired image, the texture feature vector of the image area where the slider is located is calculated using the extended LBP algorithm, and the label of the image area is predicted using the SVM support vector machine.
[0060] (9) Outputting the judgment result based on the label predicted by the slider: The type of the silk cake image to be detected is judged based on the predicted label. If the number of labels with a value of -1 is greater than 10, the silk cake image to be detected is judged to be a poorly formed image. Conversely, if the number of labels with a value of -1 is less than 10, the silk cake image to be detected is judged to be a normal image.
[0061] In step (2), the image segmentation specifically includes the following steps:
[0062] (2a) For normal images and defective images, pixel transformation is performed: a pixel value is set. If it is greater than the range of this pixel value, the pixel is changed to 255, that is, it becomes white; if it is less than the range of this pixel value, the pixel is changed to 0, that is, it becomes black;
[0063] (2b) performing vertical projection on the pixel-transformed image;
[0064] (2c) obtaining the horizontal coordinate corresponding to the threshold value of the vertical coordinate being greater than 500 after the vertical projection;
[0065] (2d) Then obtain the maximum value x1 and the minimum value x2 of these horizontal coordinates, and the length of the original image is y. Cut the original image with the four vertices (x1,0)(x2,0)(x1,y)(x2,y) to obtain a rectangle with (x1,0)(x2,0)(x1,y)(x2,y) as the four vertices. This rectangular image is the image required after removing background interference.
[0066] In step (5), the extended LBP algorithm refers to: taking each pixel in the image as the central pixel point, and comparing it with the grayscale values of 8 pixels in the 3×3 neighborhood, if the surrounding pixel values are greater than the pixel value of the central pixel point, the position of the central pixel point is marked as 1, otherwise it is 0; the 8 points in the 3×3 neighborhood are compared to generate an 8-bit binary number, and the 8-bit binary number is arranged clockwise to form a binary number, and then the binary number is converted to decimal, and the decimal number is the LBP value of the central pixel point; the LBP value of each pixel in the image is calculated, and the decimal range of the calculated LBP value is [0, 255], and the frequency of the LBP value of each pixel appearing at each place on [0, 255] is counted to construct a histogram of the LBP value of the image, and the histogram is 256-dimensional, and then 3 dimensions are added to the 256-dimensional, and the 3 dimensions store the average pixel, maximum grayscale difference and average gradient of the entire image in turn. The histogram is normalized after it is changed from the original 256-dimensional to 259-dimensional;
[0067] The extended LBP algorithm is used to calculate the texture feature vectors of each image in the training set, which specifically includes the following steps:
[0068] (5a) Divide the detection window into 16×16 small areas on each 64×64 sample image in the training set;
[0069] (5b) Each pixel in the 16×16 small area is taken as the central pixel and compared with the grayscale values of the 8 pixels in the 3×3 neighborhood. If the surrounding pixel values are greater than the pixel value of the central pixel, the position of the central pixel is marked as 1, otherwise it is marked as 0. The 8 points in the 3×3 neighborhood are compared to generate an 8-bit binary number. These 8-bit binary numbers are arranged clockwise to form a binary number. The binary number is converted to decimal, and this decimal number is the LBP value of the central pixel.
[0070] (5c) Calculate the histogram of each small area, that is, the frequency of each number, and then add 3 dimensions to the 256-dimensional histogram of each small area to store the average pixel, maximum grayscale difference, and average gradient of each small area; then normalize the histogram;
[0071] (5d) The statistical histograms of each small area are connected to form a feature vector, that is, the feature vector is the texture feature vector of the 64×64 sample image obtained using the extended LBP algorithm.
[0072] The step (6) specifically includes the following steps:
[0073] (6a) The labels of the positive samples of the training set in the data set, i.e., normal images, are set to 1, and the labels of the negative samples of the training set in the data set, i.e., poorly formed images, are set to -1;
[0074] (6b) The LBP texture feature vectors, labels of positive samples, and labels of negative samples calculated in step (5) are input into the SVM support vector machine for training, and an XML file is generated. The file stores the texture feature vectors calculated from the positive samples and negative samples, as well as the labels corresponding to the positive samples and negative samples.
[0075] The step (7) specifically includes the following steps:
[0076] (7a) Read the XML file obtained in step (6);
[0077] (7b) Set the label of each positive sample image in the test set to 1 and the label of each negative sample image to -1;
[0078] (7c) Calculate the texture feature vectors of the positive and negative sample images in the test set;
[0079] (7d) For the positive samples in the test set, the SVM support vector machine predicts whether the label corresponding to each image of the positive samples in the test set is 1 or -1 based on the texture feature vector of the positive sample image calculated in step (7c) and the texture feature vector and label 1 of the positive sample image in the XML file read in step (7a); For the negative samples in the test set, the SVM support vector machine predicts whether the label corresponding to each image of the negative samples in the test set is 1 or -1 based on the texture feature vector of the negative sample image calculated in step (7c) and the texture feature vector and label -1 of the negative sample image in the XML file read in step (7a);
[0080] (7e) Compare the labels of the predicted positive and negative sample images in the test set with the labels set in step (7b) and calculate the prediction accuracy: if the predicted label is consistent with the label set in step (7b), the prediction is judged to be correct; if the predicted label is inconsistent with the label set in step (7b), the prediction is judged to be wrong; Accuracy = the total number of correct predictions divided by the total number of labels multiplied by 100%.
[0081] The step (8) specifically includes the following steps:
[0082] (8a) Define the size of the slider: the length and width of the slider are consistent with the length and width of the positive and negative samples in the dataset;
[0083] (8b) defining the step size of the slider in horizontal and vertical translation;
[0084] (8c) Moving the slider on the image at each step to extract texture features and obtain a texture feature vector;
[0085] (8d) predicting labels for the texture feature vectors obtained from the slider according to the XML file in step (6);
[0086] (8e) Count the predicted labels.
[0087] As shown in Figure 2(a), the image is an image of a normal silk cake taken by a camera on a textile production line. It can be seen from the figure that the silk threads in the normal silk cake image are regularly wound on the cake; as shown in Figure 2(b), the image is an image of a silk cake with poor molding defects taken by a camera on a textile production line. It can be seen from the figure that the silk threads in the silk cake with poor molding defects are unevenly wound on the cake.
[0088] As shown in Figure 3(a), the image is a normal silk cake image. Due to industrial imaging problems, each image has different background interference. Therefore, image segmentation is used to remove the background interference and extract the desired part of the silk cake. As shown in Figure 3(b), the image is an image of a poorly formed silk cake. Due to industrial imaging problems, each image has different background interference. Therefore, image segmentation is used to remove the background interference and extract the desired part of the silk cake.
[0089] As shown in Figure 4(a), an image is generated from a 128×128 positive sample and then cropped into a 64×64 positive sample (without defective shapes). As shown in Figure 4(b), an image is generated from a 128×128 negative sample and then cropped into a 64×64 negative sample (with defective shapes). The negative samples are then selected and those containing normal silk cake images are deleted.
[0090] like Figure 5 As shown in, it is the accuracy of predicting the data set using the extended LBP algorithm; Figure 6 As shown, a slider with the same size as the dataset is used to slide on the entire image to predict the label, and based on the amount of labels, it is predicted whether the image belongs to a normal silk cake image or a poorly formed silk cake image.
[0091] In summary, the present invention removes the final background interference through image segmentation, so that the processed image no longer contains a large amount of interference. This solves the problem of moving from the research and verification stage in the laboratory to direct use in industrial production lines, thereby enabling chemical fiber companies to avoid a series of shortcomings caused by manual detection of yarn cake defects in industrial production. The present invention comprehensively considers the various background interferences caused by the imaging of textile yarn cakes in industrial production as well as the characteristics and distribution of the background, thereby completely removing the background interference without affecting the useful foreground information in the original image. In addition, through data sets of different sizes and different LBP feature extraction methods, normal textile yarn cakes and poorly formed textile yarn cakes are successfully output.
Claims
1. A method for detecting defects in textile cake forming based on extended local binary patterns, characterized in that: The method comprises the following steps in order: (1) Obtain silk cake images and perform downsampling: read all silk cake images in the folder and reduce the length and width of the silk cake images to the same size; (2) Image segmentation and image cropping: After image segmentation of the silk cake image after being reduced in size, background interference is removed to extract the desired image; the extracted desired image is cropped and cut into images of the same size; (3) Perform affine transformation: flip the cut image horizontally, vertically, and horizontally and vertically; (4) Obtaining a data set: The normal images in the images after affine transformation are defined as positive samples, and the images with poor forming are defined as negative samples. The positive samples and negative samples together constitute a data set, and the data set is divided into a training set and a test set in a ratio of 7:3; (5) Calculate the texture feature vector of each image in the training set through the extended LBP algorithm: Calculate the texture feature vectors of the positive sample and negative sample images in the training set, and set the label of each positive sample image in the training set to 1, and the label of each negative sample image in the training set to -1; (6) Use the SVM support vector machine to train the texture feature vectors and labels of the positive and negative sample images in the training set and generate an XML file; (7) The texture feature vector of each image in the test set is calculated through the extended LBP algorithm. The SVM support vector machine predicts the label of each image in the positive and negative samples of the test set and calculates the prediction accuracy. (8) Predicting the slider of the silk cake image to be detected: After downsampling the silk cake image to be detected, the desired image is cut out. Then, a slider of the same size as the image in the dataset is placed at the upper left corner of the cut-out desired image. Then, the slider is slid from top to bottom and from left to right. When the slider is in each area of the desired image, the texture feature vector of the image area where the slider is located is calculated by the extended LBP algorithm, and the label of the image area is predicted by the SVM support vector machine. (9) Output the judgment result based on the label predicted by the slider: Determine the type of the silk cake image to be detected based on the predicted label. If the number of labels with a value of -1 is greater than 10, the silk cake image to be detected is judged to be a poorly formed image. Conversely, if the number of labels with a value of -1 is less than 10, the silk cake image to be detected is judged to be a normal image.
2. The method for detecting defects in textile cake forming based on extended local binary patterns according to claim 1, characterized in that: In step (2), the image segmentation specifically includes the following steps: (2a) For normal images and defective images, perform pixel transformation: set a pixel value. If it is greater than the range of this pixel value, the pixel is changed to 255, that is, it becomes white; if it is less than the range of this pixel value, the pixel is changed to 0, that is, it becomes black; (2b) vertically project the pixel-transformed image; (2c) Obtain the horizontal coordinate corresponding to the threshold value of the vertical coordinate greater than 500 after the vertical projection; (2d) Then get the maximum value x1 and the minimum value x2 of these horizontal coordinates, and the length of the original image is y. Cut the original image with the four vertices (x1,0)(x2,0)(x1,y)(x2,y) to get a rectangle with (x1,0)(x2,0)(x1,y)(x2,y) as the four vertices. The rectangular image is the image required after removing background interference.
3. The method for detecting defects in textile cake forming based on extended local binary patterns according to claim 1, characterized in that: In step (5), the extended LBP algorithm refers to: taking each pixel in the image as the central pixel point, and comparing the grayscale values of the 8 pixels in the 3×3 neighborhood, if the surrounding pixel values are greater than the pixel value of the central pixel point, the position of the central pixel point is marked as 1, otherwise it is marked as 0; the 8 points in the 3×3 neighborhood are compared to generate an 8-bit binary number, the 8-bit binary number is arranged clockwise to form a binary number, and then the binary number is converted to decimal, and the decimal number is the LBP value of the central pixel point; the LBP value of each pixel in the image is calculated, the decimal range of the calculated LBP value is [0, 255], the frequency of the LBP value of each pixel appearing at each place on [0, 255] is counted, and a histogram of the LBP value of the image is constructed, the histogram is 256-dimensional, and then 3 dimensions are added to the 256-dimensional, the 3 dimensions store the average pixel, maximum grayscale difference and average gradient of the whole image in turn, the histogram is changed from the original 256-dimensional to 259-dimensional and then normalized; The extended LBP algorithm is used to calculate the texture feature vector of each image in the training set, which specifically includes the following steps: (5a) Divide the detection window into small 16×16 regions on each 64×64 sample image in the training set; (5b) Take each pixel in the 16×16 small area as the central pixel and compare it with the grayscale values of the 8 pixels in the 3×3 neighborhood. If the surrounding pixel values are greater than the pixel value of the central pixel, the position of the central pixel is marked as 1, otherwise it is marked as 0. The 8 points in the 3×3 neighborhood are compared to generate an 8-bit binary number. These 8-bit binary numbers are arranged clockwise to form a binary number. The binary number is converted to decimal. This decimal number is the LBP value of the central pixel. (5c) Calculate the histogram of each small area, that is, the frequency of each number, and then add 3 dimensions to the 256-dimensional histogram of each small area to store the average pixel, maximum grayscale difference and average gradient of each small area respectively; then normalize the histogram; (5d) The statistical histograms of each small area are connected to form a feature vector, that is, the feature vector is the texture feature vector of the 64×64 sample image obtained using the extended LBP algorithm.
4. The method for detecting textile yarn cake forming defects based on extended local binary patterns according to claim 1, characterized in that: The step (6) specifically includes the following steps: (6a) The labels of the positive samples in the training set, i.e., normal images, are set to 1, and the labels of the negative samples in the training set, i.e., poorly formed images, are set to -1; (6b) The LBP texture feature vector, the label of the positive sample, and the label of the negative sample calculated in step (5) are input into the SVM support vector machine for training, and an XML file is generated. The file stores the texture feature vector calculated by the positive sample and the negative sample, as well as the labels corresponding to the positive sample and the negative sample.
5. The method for detecting textile yarn cake forming defects based on extended local binary patterns according to claim 1, characterized in that: The step (7) specifically includes the following steps: (7a) Read the XML file obtained in step (6); (7b) Set the label of each positive sample image in the test set to 1, and the label of each negative sample image to -1; (7c) Calculate the texture feature vectors of the positive and negative sample images in the test set; (7d) For the positive samples in the test set, the SVM support vector machine predicts whether the label corresponding to each image of the positive samples in the test set is 1 or -1 based on the texture feature vector of the positive sample image calculated in step (7c) and the texture feature vector and label 1 of the positive sample image in the XML file read in step (7a); For the negative samples in the test set, the SVM support vector machine predicts whether the label corresponding to each image of the negative samples in the test set is 1 or -1 based on the texture feature vector of the negative sample image calculated in step (7c) and the texture feature vector and label -1 of the negative sample image in the XML file read in step (7a); (7e) Compare the labels of the predicted positive and negative sample images in the test set with the labels set in step (7b) and calculate the prediction accuracy: if the predicted label is consistent with the label set in step (7b), the prediction is judged to be correct; if the predicted label is inconsistent with the label set in step (7b), the prediction is judged to be wrong; Accuracy = the total number of correct predictions divided by the total number of labels multiplied by 100%.
6. The method for detecting textile yarn cake forming defects based on extended local binary patterns according to claim 1, characterized in that: The step (8) specifically includes the following steps: (8a) Define the size of the slider: the length and width of the slider are consistent with the length and width of the positive and negative samples in the dataset; (8b) define the step size of the slider in horizontal and vertical translation; (8c) Move the slider on the image one step at a time to extract texture features and obtain a texture feature vector; (8d) predicting labels for the texture feature vectors obtained from the slider according to the XML file in step (6); (8e) Count the predicted labels.
Citation Information
Patent Citations
Face recognition method based on improved local binary pattern
CN109344758A
Discriminant dictionary learning textile image classification method based on inter-class fuzzy suppression
CN112183660A