CN114511527A - Textile spinning cake forming defect detection method based on expanded local binary pattern - Google Patents
Textile spinning cake forming defect detection method based on expanded local binary pattern Download PDFInfo
- Publication number
- CN114511527A CN114511527A CN202210080786.7A CN202210080786A CN114511527A CN 114511527 A CN114511527 A CN 114511527A CN 202210080786 A CN202210080786 A CN 202210080786A CN 114511527 A CN114511527 A CN 114511527A
- Authority
- CN
- China
- Prior art keywords
- image
- label
- spinning cake
- texture feature
- pixel
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000009987 spinning Methods 0.000 title claims abstract description 67
- 230000007547 defect Effects 0.000 title claims abstract description 28
- 239000004753 textile Substances 0.000 title claims abstract description 23
- 238000001514 detection method Methods 0.000 title claims abstract description 19
- 239000013598 vector Substances 0.000 claims abstract description 57
- 238000012706 support-vector machine Methods 0.000 claims abstract description 38
- 238000012549 training Methods 0.000 claims abstract description 37
- 238000012360 testing method Methods 0.000 claims abstract description 32
- 238000000034 method Methods 0.000 claims abstract description 24
- 238000003709 image segmentation Methods 0.000 claims abstract description 17
- 230000009466 transformation Effects 0.000 claims abstract description 10
- PXFBZOLANLWPMH-UHFFFAOYSA-N 16-Epiaffinine Natural products C1C(C2=CC=CC=C2N2)=C2C(=O)CC2C(=CC)CN(C)C1C2CO PXFBZOLANLWPMH-UHFFFAOYSA-N 0.000 claims abstract description 7
- 238000005070 sampling Methods 0.000 claims abstract description 7
- 238000004364 calculation method Methods 0.000 claims description 12
- 238000013519 translation Methods 0.000 claims description 6
- 238000005520 cutting process Methods 0.000 claims description 4
- 238000012545 processing Methods 0.000 claims description 4
- 238000006243 chemical reaction Methods 0.000 claims description 3
- 238000010606 normalization Methods 0.000 claims description 3
- 238000006748 scratching Methods 0.000 claims description 3
- 230000002393 scratching effect Effects 0.000 claims description 3
- 238000009776 industrial production Methods 0.000 abstract description 9
- 238000011160 research Methods 0.000 abstract description 6
- 238000012795 verification Methods 0.000 abstract description 4
- 238000004519 manufacturing process Methods 0.000 description 6
- 230000015572 biosynthetic process Effects 0.000 description 5
- 238000003384 imaging method Methods 0.000 description 5
- 238000000605 extraction Methods 0.000 description 4
- 238000010801 machine learning Methods 0.000 description 4
- 238000000465 moulding Methods 0.000 description 4
- 238000011161 development Methods 0.000 description 2
- 230000018109 developmental process Effects 0.000 description 2
- 238000009826 distribution Methods 0.000 description 2
- 239000000835 fiber Substances 0.000 description 2
- 238000003672 processing method Methods 0.000 description 2
- 239000000126 substance Substances 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000005034 decoration Methods 0.000 description 1
- 238000013135 deep learning Methods 0.000 description 1
- 230000007123 defense Effects 0.000 description 1
- 230000002950 deficient Effects 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 239000004744 fabric Substances 0.000 description 1
- 239000000463 material Substances 0.000 description 1
- 239000002994 raw material Substances 0.000 description 1
- 238000004804 winding Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
- G06T7/0004—Industrial image inspection
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01N—INVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
- G01N21/00—Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
- G01N21/84—Systems specially adapted for particular applications
- G01N21/88—Investigating the presence of flaws or contamination
- G01N21/8851—Scan or image signal processing specially adapted therefor, e.g. for scan signal adjustment, for detecting different kinds of defects, for compensating for structures, markings, edges
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/21—Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
- G06F18/214—Generating training patterns; Bootstrap methods, e.g. bagging or boosting
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/24—Classification techniques
- G06F18/241—Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
- G06F18/2411—Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on the proximity to a decision surface, e.g. support vector machines
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/11—Region-based segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/40—Analysis of texture
- G06T7/41—Analysis of texture based on statistical description of texture
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10024—Color image
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20081—Training; Learning
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20112—Image segmentation details
- G06T2207/20132—Image cropping
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30108—Industrial image inspection
- G06T2207/30124—Fabrics; Textile; Paper
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Computer Vision & Pattern Recognition (AREA)
- General Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Life Sciences & Earth Sciences (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Bioinformatics & Computational Biology (AREA)
- Artificial Intelligence (AREA)
- Evolutionary Biology (AREA)
- Evolutionary Computation (AREA)
- General Engineering & Computer Science (AREA)
- Health & Medical Sciences (AREA)
- Signal Processing (AREA)
- Chemical & Material Sciences (AREA)
- Analytical Chemistry (AREA)
- Biochemistry (AREA)
- General Health & Medical Sciences (AREA)
- Immunology (AREA)
- Pathology (AREA)
- Quality & Reliability (AREA)
- Probability & Statistics with Applications (AREA)
- Image Analysis (AREA)
Abstract
The invention relates to a textile spinning cake forming defect detection method based on an expanded local binary pattern, which comprises the following steps: acquiring a spinning cake image, and performing down-sampling on the image; image segmentation and image cropping; affine transformation; acquiring a data set; calculating texture feature vectors of all images in the training set through an extended LBP algorithm; generating an XML file; calculating texture feature vectors of all images in the test set, predicting the label of each image in the positive sample and the negative sample of the test set by an SVM (support vector machine), and calculating the prediction accuracy; carrying out slide block prediction on a spinning cake image to be detected; and outputting a judgment result according to the label predicted by the sliding block. The method removes the final background interference through image segmentation, so that the processed image does not contain a large amount of interference any more, and the method solves the problem that the processed image can be directly used in an industrial production line from the research and verification stage staying in a laboratory.
Description
Technical Field
The invention relates to the technical field of 2D industrial image processing, in particular to a textile spinning cake poor forming defect detection method based on an extended local binary pattern.
Background
In daily life, textiles are visible everywhere, and as a big agricultural country, China flourishes various textiles such as silk from ancient times. The spinning cake becomes an important textile raw material due to the advantages of high strength, wear resistance, small density, good elasticity and the like, is wound by textile filaments, is widely applied to the fields of fabrics, clothes, building interior decorations and the like, and also relates to the fields of national defense and aerospace, biomedical materials, energy development and the like. The quality of the spinning cake affects the quality of the textile. The defect detection of the spinning cake on the industrial production line mainly adopts manual detection, but the detection method is greatly influenced by the manual detection, so that the production efficiency and the accuracy are low, the labor cost is high, the labor cost is continuously increased, and the development of textile enterprises is subjected to bottleneck. At present, professors and scholars of various colleges and universities in China are still in the starting stage of automatic defect detection research on textile products, and although relevant results such as treatises and patents are obtained, the results are not mature and can only stay in the research and verification stage of a laboratory. The method mainly comprises three ideas aiming at the research of a defective spinning cake forming method of a textile image: firstly, machine learning some traditional feature extraction algorithms are used, then the images are processed into a data set and then trained to obtain feature vectors, then the accuracy is calculated by combining labels and some classification methods of machine learning, and finally, whether the images belong to poor forming or not is detected after slider prediction is carried out on the whole images; however, some traditional feature extraction methods and machine learning classification methods for machine learning are more in variety, and how to select and expand the features is performed to obtain high accuracy; and how to avoid a series of interferences brought by imaging on an industrial production line in the learning process. The second is a method using deep learning. And thirdly, using some conventional image processing methods. The traditional image processing method has high efficiency and high stability, but has larger limitation.
Therefore, how to detect the defect of poor spinning cake forming in a high-accuracy, high-efficiency and real-time manner and use the defect in a production line of some textile manufacturing enterprises in time becomes a technical problem which needs to be solved urgently.
Disclosure of Invention
The invention aims to provide a textile spinning cake poor forming defect detection method based on an extended local binary pattern, which can successfully realize automatic defect detection of a textile spinning cake and greatly improve the production efficiency and the product quality of the textile spinning cake defect detection.
In order to achieve the purpose, the invention adopts the following technical scheme: a textile spinning cake forming defect detection method based on an expanded local binary pattern comprises the following steps in sequence:
(1) obtaining a spinning cake image, and performing down-sampling: reading all spinning cake images in the folder, and reducing the length and the width of the spinning cake images by equal size;
(2) performing image segmentation and image cropping: carrying out image segmentation on the spinning cake image after being greatly reduced, removing background interference, and digging out a required image; cutting the needed image into the same size;
(3) carrying out affine transformation: horizontally, vertically, horizontally and vertically turning the cut image;
(4) acquiring a data set: defining a normal image in the image subjected to affine transformation as a positive sample, defining an image with poor forming as a negative sample, forming a data set by the positive sample and the negative sample together, and dividing the data set into a training set and a testing set according to a ratio of 7: 3;
(5) calculating the texture feature vector of each image in the training set through an extended LBP algorithm: calculating texture feature vectors of positive sample images and negative sample images in a training set, setting the label of each image of the positive samples in the training set as 1, and setting the label of each image of the negative samples in the training set as-1;
(6) training texture feature vectors and labels of positive samples and negative sample images of a training set by using an SVM (support vector machine) to generate an XML (extensive Makeup language) file;
(7) calculating texture feature vectors of all images in the test set through an expanded LBP algorithm, predicting labels of each image in a positive sample and a negative sample of the test set through an SVM support vector machine, and calculating prediction accuracy;
(8) and (3) carrying out slide block prediction on a spinning cake image to be detected: sampling a spinning cake image to be detected, then scratching out a required image, placing a slide block with the size equal to that of a data set image at the leftmost upper corner of the scratched out required image, sliding the slide block from top to bottom and from left to right, calculating a texture feature vector of an image area where the slide block is located through an expanded LBP algorithm when the slide block is located in each area of the required image, and predicting a label of the image area through an SVM (support vector machine);
(9) outputting a judgment result according to the label predicted by the sliding block: judging the type of the spinning cake image to be detected according to the predicted labels, if the number of the labels is-1 is more than 10, judging the spinning cake image to be detected to belong to a poor forming image, otherwise, if the number of the labels is-1 is less than 10, judging the spinning cake image to be detected to belong to a normal image.
In the step (2), the performing image segmentation specifically includes the following steps:
(2a) and (3) performing pixel transformation on the normal image and the poor forming image: setting a pixel value, and if the pixel value is larger than the range of the pixel value, changing the pixel to be 255, namely, white; if the pixel value is less than the range of the pixel value, the pixel is changed to 0, namely, to black;
(2b) vertically projecting the image after pixel conversion;
(2c) acquiring an abscissa corresponding to a threshold value of which the ordinate is greater than 500 after the vertical projection;
(2d) then, the maximum value x1 and the minimum value x2 of the abscissa are obtained, the length of the original image is y, and the original image is cut by four vertexes (x1,0) (x2,0) (x1, y) (x2, y) to obtain a rectangle with four vertexes (x1,0) (x2,0) (x1, y) (x2, y), and the rectangle image is an image required after background interference is removed.
In step (5), the extended LBP algorithm refers to: taking each pixel in the image as a central pixel point, comparing the central pixel point with gray values of 8 pixels in a 3 multiplied by 3 neighborhood, if the surrounding pixel values are greater than the pixel value of the central pixel point, marking the position of the central pixel point as 1, otherwise, marking the position of the central pixel point as 0; 8 points in a 3 multiplied by 3 neighborhood are compared to generate 8-bit binary numbers, the 8-bit binary numbers are arranged clockwise to form a binary number, and then the binary number is converted into a decimal number, and the decimal number is the LBP value of the central pixel point; calculating the LBP value of each pixel on the image, wherein the decimal range of the calculated LBP value is [0, 255], counting the frequency of the LBP value of each pixel appearing in each place on [0, 255], constructing a histogram of the LBP value of the image, wherein the histogram is 256-dimensional, then adding 3-dimensional on the 256-dimensional, wherein the 3-dimensional stores the average pixel, the maximum gray difference and the average gradient of the whole image in sequence, and carrying out normalization processing after the histogram is changed from the original 256-dimensional to 259-dimensional;
the method for calculating the texture feature vector of each image in the training set through the extended LBP algorithm specifically comprises the following steps:
(5a) dividing a detection window into 16 × 16 small areas on each 64 × 64 sample image in a training set;
(5b) taking each pixel in a 16 × 16 small region as a central pixel point, comparing the central pixel point with gray values of 8 pixels in a 3 × 3 neighborhood, if the surrounding pixel values are greater than the pixel value of the central pixel point, marking the position of the central pixel point as 1, otherwise, marking the position as 0; 8 points in a 3 multiplied by 3 neighborhood are compared to generate 8-bit binary numbers, the 8-bit binary numbers are arranged clockwise to form a binary number, the binary number is converted into a decimal number, and the decimal number is the LBP value of the central pixel point;
(5c) calculating a histogram of each small region, namely the frequency of each digital occurrence, then adding 3 dimensions to the 256-dimensional histogram of each small region, and respectively storing the average pixel, the maximum gray difference and the average gradient of each small region; then, normalizing the histogram;
(5d) and connecting the obtained statistical histograms of the small regions into a feature vector, namely, the feature vector is the texture feature vector of the 64 × 64 sample image obtained by using the extended LBP algorithm.
The step (6) specifically comprises the following steps:
(6a) setting a label of a normal image as a positive sample of a training set in a data set to be 1, and setting a label of a bad forming image as a negative sample of the training set in the data set to be-1;
(6b) and (4) inputting the LBP texture feature vector, the label of the positive sample and the label of the negative sample obtained by calculation in the step (5) into an SVM support vector machine for training, generating an XML file, and storing the texture feature vector obtained by calculation of the positive sample and the negative sample and the labels corresponding to the positive sample and the negative sample in the file.
The step (7) specifically comprises the following steps:
(7a) reading the XML file obtained in the step (6);
(7b) setting the label of each image of the positive sample in the test set to be 1, and setting the label of each image of the negative sample to be-1;
(7c) calculating texture feature vectors of positive and negative sample images in the test set;
(7d) aiming at the positive sample in the test set, predicting whether the label corresponding to each image of the positive sample in the test set is 1 or-1 according to the positive sample image texture feature vector obtained by calculation in the step (7c) and the texture feature vector and the label 1 of the positive sample image in the XML file read in the step (7a) by an SVM (support vector machine); aiming at the negative sample in the test set, predicting whether the label corresponding to each image of the negative sample in the test set is 1 or-1 according to the texture feature vector of the negative sample image obtained by calculation in the step (7c) and the texture feature vector and the label-1 of the negative sample image in the XML file read in the step (7a) by the SVM support vector machine;
(7e) and (4) comparing the labels of the positive and negative sample images in the predicted test set with the labels set in the step (7b), and calculating the prediction accuracy: if the predicted label is consistent with the label set in the step (7b), judging that the prediction is correct; if the predicted label is inconsistent with the label set in the step (7b), judging that the prediction is wrong; accuracy is the total number of predicted correct divided by the total number of tags multiplied by 100%.
The step (8) specifically comprises the following steps:
(8a) defining 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 data set;
(8b) defining the step length of the slide block in horizontal translation and vertical translation;
(8c) moving the slide block on the image for each step to extract texture features to obtain texture feature vectors;
(8d) predicting a label for the texture feature vector obtained by the sliding block according to the XML file in the step (6);
(8e) and counting the predicted labels.
According to the technical scheme, the invention has the beneficial effects that: firstly, the final background interference is removed through image segmentation, so that the processed image does not contain a large amount of interference any more, and therefore, the problem that the processed image can be directly used in an industrial production line from a research and verification stage staying in a laboratory is solved, and a series of defects caused by manual detection of spinning cake defects in industrial production are avoided for chemical fiber enterprises; secondly, the invention comprehensively considers various background interferences of the spinning cakes and the characteristics and the distribution of the background caused by the imaging of the industrial production, thereby completely removing the background interferences without influencing useful foreground information in the original image, and successfully outputting the normal spinning cakes and the poorly formed spinning cakes through data sets with different sizes and LBP characteristic extraction in different modes. Thirdly, the method has high accuracy and short time consumption for detecting the poor forming defects of the spinning cakes.
Drawings
FIG. 1 is a flow chart of a method of the present invention;
FIG. 2(a) is a normal spinning cake image;
FIG. 2(b) is an image of a textile cake with a defect of poor formation;
FIG. 3(a) is a normal spinning cake image after image segmentation;
FIG. 3(b) is an image of a textile cake with poor formation after image segmentation;
fig. 4(a) is an image cut into 64 × 64 positive samples;
fig. 4(b) is an image cropped to a 64 × 64 negative sample;
FIG. 5 is a graph of accuracy of a prediction data set using extended LBP;
fig. 6 is a diagram for predicting whether the entire image is a normal image or an image having a molding defect by using a slider.
Detailed Description
As shown in fig. 1, a method for detecting poor formation defect of spinning cake based on extended local binary pattern comprises the following steps:
(1) obtaining a spinning cake image, and performing down-sampling: reading all spinning cake images in the folder, and reducing the length and the width of the spinning cake images by equal size;
(2) performing image segmentation and image cropping: carrying out image segmentation on the spinning cake image after being greatly reduced, removing background interference, and digging out a required image; cutting the needed image into the same size;
(3) carrying out affine transformation: horizontally, vertically, horizontally and vertically turning the cut image;
(4) acquiring a data set: defining a normal image in the image subjected to affine transformation as a positive sample, defining an image with poor forming as a negative sample, forming a data set by the positive sample and the negative sample together, and dividing the data set into a training set and a testing set according to a ratio of 7: 3;
(5) calculating the texture feature vector of each image in the training set through an extended LBP algorithm: calculating texture feature vectors of positive sample images and negative sample images in the training set, setting the label of each image of the positive samples in the training set to be 1, and setting the label of each image of the negative samples in the training set to be-1;
(6) training texture feature vectors and labels of positive samples and negative sample images of a training set by using an SVM (support vector machine) to generate an XML (extensive Makeup language) file;
(7) calculating texture feature vectors of all images in the test set through an expanded LBP algorithm, predicting labels of each image in a positive sample and a negative sample of the test set through an SVM support vector machine, and calculating prediction accuracy;
(8) and (3) carrying out slide block prediction on a spinning cake image to be detected: sampling a spinning cake image to be detected, then scratching out a required image, placing a slide block with the size equal to that of a data set image at the leftmost upper corner of the scratched out required image, sliding the slide block from top to bottom and from left to right, calculating a texture feature vector of an image area where the slide block is located through an expanded LBP algorithm when the slide block is located in each area of the required image, and predicting a label of the image area through an SVM (support vector machine);
(9) and outputting a judgment result according to the label predicted by the sliding block: judging the type of the spinning cake image to be detected according to the predicted labels, if the number of the labels is-1 is more than 10, judging that the spinning cake image to be detected belongs to a poor forming image, and if the number of the labels is-1 is less than 10, judging that the spinning cake image to be detected belongs to a normal image.
In the step (2), the performing image segmentation specifically includes the following steps:
(2a) and (3) performing pixel transformation on the normal image and the poor forming image: setting a pixel value, and if the pixel value is larger than the range of the pixel value, changing the pixel to be 255, namely, white; if the pixel value is less than the range of the pixel value, the pixel is changed to 0, namely, to black;
(2b) vertically projecting the image after pixel conversion;
(2c) acquiring an abscissa corresponding to a threshold value of which the ordinate is greater than 500 after the vertical projection;
(2d) then, the maximum value x1 and the minimum value x2 of the abscissa are obtained, the length of the original image is y, and the original image is cut by four vertexes (x1,0) (x2,0) (x1, y) (x2, y) to obtain a rectangle with four vertexes (x1,0) (x2,0) (x1, y) (x2, y), and the rectangle image is an image required after background interference is removed.
In step (5), the extended LBP algorithm refers to: taking each pixel in the image as a central pixel point, comparing the central pixel point with gray values of 8 pixels in a 3 multiplied by 3 neighborhood, if the surrounding pixel values are greater than the pixel value of the central pixel point, marking the position of the central pixel point as 1, otherwise, marking the position of the central pixel point as 0; 8 points in a 3 multiplied by 3 neighborhood are compared to generate 8-bit binary numbers, the 8-bit binary numbers are arranged clockwise to form a binary number, and then the binary number is converted into a decimal number, and the decimal number is the LBP value of the central pixel point; calculating the LBP value of each pixel on the image, wherein the decimal range of the calculated LBP value is [0, 255], counting the frequency of the LBP value of each pixel appearing in each place on [0, 255], constructing a histogram of the LBP value of the image, wherein the histogram is 256-dimensional, then adding 3-dimensional on 256-dimensional, sequentially storing the average pixel, the maximum gray difference and the average gradient of the whole image in the 3-dimensional mode, and carrying out normalization processing after the original 256-dimensional histogram is changed into 259-dimensional;
the method for calculating the texture feature vector of each image in the training set through the extended LBP algorithm specifically comprises the following steps:
(5a) dividing a detection window into 16 × 16 small areas on each 64 × 64 sample image in a training set;
(5b) taking each pixel in a 16 × 16 small region as a central pixel point, comparing the central pixel point with gray values of 8 pixels in a 3 × 3 neighborhood, if the surrounding pixel values are greater than the pixel value of the central pixel point, marking the position of the central pixel point as 1, otherwise, marking the position as 0; 8 points in a 3 multiplied by 3 neighborhood are compared to generate 8-bit binary numbers, the 8-bit binary numbers are arranged clockwise to form a binary number, the binary number is converted into a decimal number, and the decimal number is the LBP value of the central pixel point;
(5c) calculating a histogram of each small region, namely the frequency of occurrence of each number, then adding 3 dimensions to the 256-dimensional histogram of each small region, and respectively storing the average pixel, the maximum gray difference and the average gradient of each small region; then, normalizing the histogram;
(5d) and connecting the obtained statistical histograms of the small regions into a feature vector, namely, the feature vector is the texture feature vector of the 64 × 64 sample image obtained by using the extended LBP algorithm.
The step (6) specifically comprises the following steps:
(6a) setting a positive sample of a training set in a data set, namely a label of a normal image, as 1, and setting a negative sample of the training set in the data set, namely a label of a forming bad image, as-1;
(6b) and (4) inputting the LBP texture feature vector, the label of the positive sample and the label of the negative sample obtained by calculation in the step (5) into an SVM support vector machine for training, generating an XML file, and storing the texture feature vector obtained by calculation of the positive sample and the negative sample and the labels corresponding to the positive sample and the negative sample in the file.
The step (7) specifically comprises the following steps:
(7a) reading the XML file obtained in the step (6);
(7b) setting the label of each image of the positive samples in the test set as 1, and setting the label of each image of the negative samples as-1;
(7c) calculating texture feature vectors of positive and negative sample images in the test set;
(7d) aiming at the positive sample in the test set, predicting whether the label corresponding to each image of the positive sample in the test set is 1 or-1 according to the positive sample image texture feature vector obtained by calculation in the step (7c) and the texture feature vector and the label 1 of the positive sample image in the XML file read in the step (7a) by an SVM (support vector machine); aiming at the negative sample in the test set, predicting whether the label corresponding to each image of the negative sample in the test set is 1 or-1 according to the texture feature vector of the negative sample image obtained by calculation in the step (7c) and the texture feature vector and the label-1 of the negative sample image in the XML file read in the step (7a) by the SVM support vector machine;
(7e) and (4) comparing the labels of the positive and negative sample images in the predicted test set with the labels set in the step (7b), and calculating the prediction accuracy: if the predicted label is consistent with the label set in the step (7b), judging that the prediction is correct; if the predicted label is inconsistent with the label set in the step (7b), judging that the prediction is wrong; accuracy is the total number of predicted correct divided by the total number of tags multiplied by 100%.
The step (8) specifically comprises the following steps:
(8a) defining 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 data set;
(8b) defining the step length of the slide block in horizontal translation and vertical translation;
(8c) moving the slide block on the image for each step to extract texture features to obtain texture feature vectors;
(8d) predicting a label for the texture feature vector obtained by the sliding block according to the XML file in the step (6);
(8e) and counting the predicted labels.
As shown in fig. 2(a), the image is a normal spinning cake image taken by a camera on a textile industry production line, and the image shows that the silk on the normal spinning cake image is regularly wound on the cake; as shown in fig. 2(b), the image is a cake image with a molding defect taken by a camera on a production line of a textile industry, and the winding of the filaments on the cake image with the molding defect in a convex-concave manner can be seen from the image.
As shown in fig. 3(a), the image is a normal spinning cake image, each image has different background interference due to an industrial imaging problem, and therefore, the background interference is removed through image segmentation to extract a part of a required spinning cake; as shown in fig. 3(b), the image is a cake image with poor formation, each image has different background interference due to industrial imaging problems, and therefore the background interference is removed by image segmentation, and a part of a desired cake is extracted.
As shown in fig. 4(a), the image is a positive sample (without poor molding) that passes through a 128 × 128 positive sample and then is cut into a size of 64 × 64; as shown in fig. 4(b), the image is obtained by cutting a 128 × 128 negative sample into a negative sample (with poor formation) with a size of 64 × 64, and selecting to delete the negative sample containing the normal spinning cake image.
As shown in fig. 5, to predict the accuracy of the data set using the extended LBP algorithm; as shown in fig. 6, the entire image is slid using a slider of the size of the data set to predict the label, and whether the image belongs to a normal spinning cake image or a poorly formed spinning cake image is predicted according to the amount of the label.
In conclusion, the final background interference is removed through image segmentation, so that the processed image does not contain a large amount of interference any more, and therefore, the problem that the processed image can be directly used in an industrial production line from a research and verification stage staying in a laboratory is solved, and a series of defects caused by manual detection of spinning cake defects in industrial production are avoided for chemical fiber enterprises; the invention comprehensively considers various background interferences of the spinning cakes and the characteristics and the distribution of the background caused by the imaging of industrial production, thereby completely removing the background interferences without influencing useful foreground information in the original image, and successfully outputting the normal spinning cakes and the poorly formed spinning cakes through data sets with different sizes and LBP characteristic extraction in different modes.
Claims (6)
1. A textile spinning cake forming defect detection method based on an expanded local binary pattern is characterized by comprising the following steps: the method comprises the following steps in sequence:
(1) obtaining a spinning cake image, and performing down-sampling: reading all spinning cake images in the folder, and reducing the length and the width of the spinning cake images in an equal size;
(2) performing image segmentation and image cropping: carrying out image segmentation on the spinning cake image after being greatly reduced, removing background interference, and digging out a required image; cutting the needed image into the same size;
(3) carrying out affine transformation: horizontally, vertically, horizontally and vertically turning the cut image;
(4) acquiring a data set: defining a normal image in the image subjected to affine transformation as a positive sample, defining an image with poor forming as a negative sample, forming a data set by the positive sample and the negative sample together, and dividing the data set into a training set and a testing set according to a ratio of 7: 3;
(5) calculating the texture feature vector of each image in the training set through an extended LBP algorithm: calculating texture feature vectors of positive sample images and negative sample images in the training set, setting the label of each image of the positive samples in the training set to be 1, and setting the label of each image of the negative samples in the training set to be-1;
(6) training texture feature vectors and labels of positive samples and negative sample images of a training set by using an SVM (support vector machine) to generate an XML (extensive Makeup language) file;
(7) calculating texture feature vectors of all images in the test set through an expanded LBP algorithm, predicting labels of each image in a positive sample and a negative sample of the test set through an SVM (support vector machine), and calculating prediction accuracy;
(8) and (3) carrying out slide block prediction on a spinning cake image to be detected: sampling a spinning cake image to be detected, then scratching out a required image, placing a slide block with the size equal to that of a data set image at the leftmost upper corner of the scratched out required image, sliding the slide block from top to bottom and from left to right, calculating a texture feature vector of an image area where the slide block is located through an expanded LBP algorithm when the slide block is located in each area of the required image, and predicting a label of the image area through an SVM (support vector machine);
(9) and outputting a judgment result according to the label predicted by the sliding block: judging the type of the spinning cake image to be detected according to the predicted labels, if the number of the labels is-1 is more than 10, judging the spinning cake image to be detected to belong to a poor forming image, otherwise, if the number of the labels is-1 is less than 10, judging the spinning cake image to be detected to belong to a normal image.
2. The method for detecting poor spinning cake forming defects based on the extended local binary pattern as claimed in claim 1, wherein the method comprises the following steps: in the step (2), the performing image segmentation specifically includes the following steps:
(2a) and (3) performing pixel transformation on the normal image and the poor forming image: setting a pixel value, and if the pixel value is larger than the range of the pixel value, changing the pixel to be 255, namely, white; if the pixel value is less than the range of the pixel value, the pixel is changed to 0, namely, to black;
(2b) vertically projecting the image after pixel conversion;
(2c) acquiring an abscissa corresponding to a threshold value of which the ordinate is greater than 500 after the vertical projection;
(2d) then, the maximum value x1 and the minimum value x2 of the abscissa are obtained, the length of the original image is y, and the original image is cut by four vertexes (x1,0) (x2,0) (x1, y) (x2, y) to obtain a rectangle with four vertexes (x1,0) (x2,0) (x1, y) (x2, y), and the rectangle image is an image required after background interference is removed.
3. The method for detecting the poor forming defect of the textile spinning cake based on the extended local binary pattern as claimed in claim 1, characterized in that: in step (5), the extended LBP algorithm refers to: taking each pixel in the image as a central pixel point, comparing the central pixel point with gray values of 8 pixels in a 3 multiplied by 3 neighborhood, if the surrounding pixel values are greater than the pixel value of the central pixel point, marking the position of the central pixel point as 1, otherwise, marking the position of the central pixel point as 0; 8 points in a 3 multiplied by 3 neighborhood are compared to generate 8-bit binary numbers, the 8-bit binary numbers are arranged clockwise to form a binary number, and then the binary number is converted into a decimal number, and the decimal number is the LBP value of the central pixel point; calculating the LBP value of each pixel on the image, wherein the decimal range of the calculated LBP value is [0, 255], counting the frequency of the LBP value of each pixel appearing in each place on [0, 255], constructing a histogram of the LBP value of the image, wherein the histogram is 256-dimensional, then adding 3-dimensional on the 256-dimensional, wherein the 3-dimensional stores the average pixel, the maximum gray difference and the average gradient of the whole image in sequence, and carrying out normalization processing after the histogram is changed from the original 256-dimensional to 259-dimensional;
the method for calculating the texture feature vector of each image in the training set through the extended LBP algorithm specifically comprises the following steps:
(5a) dividing a detection window into 16 × 16 small areas on each 64 × 64 sample image in a training set;
(5b) taking each pixel in a 16 × 16 small region as a central pixel point, comparing the central pixel point with gray values of 8 pixels in a 3 × 3 neighborhood, if the surrounding pixel values are greater than the pixel value of the central pixel point, marking the position of the central pixel point as 1, otherwise, marking the position as 0; 8 points in a 3 multiplied by 3 neighborhood are compared to generate 8-bit binary numbers, the 8-bit binary numbers are arranged clockwise to form a binary number, the binary number is converted into a decimal number, and the decimal number is the LBP value of the central pixel point;
(5c) calculating a histogram of each small region, namely the frequency of each digital occurrence, then adding 3 dimensions to the 256-dimensional histogram of each small region, and respectively storing the average pixel, the maximum gray difference and the average gradient of each small region; then, normalizing the histogram;
(5d) and connecting the obtained statistical histograms of the small regions into a feature vector, namely, the feature vector is the texture feature vector of the 64 × 64 sample image obtained by using the extended LBP algorithm.
4. The method for detecting poor spinning cake forming defects based on the extended local binary pattern as claimed in claim 1, wherein the method comprises the following steps: the step (6) specifically comprises the following steps:
(6a) setting a label of a normal image as a positive sample of a training set in a data set to be 1, and setting a label of a bad forming image as a negative sample of the training set in the data set to be-1;
(6b) and (4) inputting the LBP texture feature vector, the label of the positive sample and the label of the negative sample obtained by calculation in the step (5) into an SVM support vector machine for training, generating an XML file, and storing the texture feature vector obtained by calculation of the positive sample and the negative sample and the labels corresponding to the positive sample and the negative sample in the file.
5. The method for detecting poor spinning cake forming defects based on the extended local binary pattern as claimed in claim 1, wherein the method comprises the following steps: the step (7) specifically comprises the following steps:
(7a) reading the XML file obtained in the step (6);
(7b) setting the label of each image of the positive sample in the test set to be 1, and setting the label of each image of the negative sample to be-1;
(7c) calculating texture feature vectors of positive and negative sample images in the test set;
(7d) aiming at the positive sample in the test set, predicting whether the label corresponding to each image of the positive sample in the test set is 1 or-1 according to the positive sample image texture feature vector obtained by calculation in the step (7c) and the texture feature vector and the label 1 of the positive sample image in the XML file read in the step (7a) by an SVM (support vector machine); aiming at the negative sample in the test set, predicting whether the label corresponding to each image of the negative sample in the test set is 1 or-1 according to the texture feature vector of the negative sample image obtained by calculation in the step (7c) and the texture feature vector and the label-1 of the negative sample image in the XML file read in the step (7a) by the SVM support vector machine;
(7e) and (4) comparing the labels of the positive and negative sample images in the predicted test set with the labels set in the step (7b), and calculating the prediction accuracy: if the predicted label is consistent with the label set in the step (7b), judging that the prediction is correct; if the predicted label is inconsistent with the label set in the step (7b), judging that the prediction is wrong; accuracy is the total number of predicted correct divided by the total number of tags multiplied by 100%.
6. The method for detecting poor spinning cake forming defects based on the extended local binary pattern as claimed in claim 1, wherein the method comprises the following steps: the step (8) specifically comprises the following steps:
(8a) defining 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 data set;
(8b) defining the step length of the slide block in horizontal translation and vertical translation;
(8c) moving the slide block on the image for each step to extract texture features to obtain texture feature vectors;
(8d) predicting labels of the texture feature vectors obtained by the sliding blocks according to the XML file in the step (6);
(8e) and counting the predicted labels.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210080786.7A CN114511527A (en) | 2022-01-24 | 2022-01-24 | Textile spinning cake forming defect detection method based on expanded local binary pattern |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210080786.7A CN114511527A (en) | 2022-01-24 | 2022-01-24 | Textile spinning cake forming defect detection method based on expanded local binary pattern |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114511527A true CN114511527A (en) | 2022-05-17 |
Family
ID=81549962
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210080786.7A Pending CN114511527A (en) | 2022-01-24 | 2022-01-24 | Textile spinning cake forming defect detection method based on expanded local binary pattern |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114511527A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115035515A (en) * | 2022-06-15 | 2022-09-09 | 电子科技大学 | Nang identification method |
CN115240122A (en) * | 2022-09-22 | 2022-10-25 | 南昌工程学院 | Air preheater area identification method based on deep reinforcement learning |
CN116229182A (en) * | 2023-03-22 | 2023-06-06 | 云南农业大学 | Small particle coffee defect green bean detection method based on feature fusion |
CN116593493A (en) * | 2023-04-21 | 2023-08-15 | 江苏精益智控科技有限公司 | Device and method for detecting defects of inner surface of steel pipe at high speed |
-
2022
- 2022-01-24 CN CN202210080786.7A patent/CN114511527A/en active Pending
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115035515A (en) * | 2022-06-15 | 2022-09-09 | 电子科技大学 | Nang identification method |
CN115240122A (en) * | 2022-09-22 | 2022-10-25 | 南昌工程学院 | Air preheater area identification method based on deep reinforcement learning |
CN116229182A (en) * | 2023-03-22 | 2023-06-06 | 云南农业大学 | Small particle coffee defect green bean detection method based on feature fusion |
CN116593493A (en) * | 2023-04-21 | 2023-08-15 | 江苏精益智控科技有限公司 | Device and method for detecting defects of inner surface of steel pipe at high speed |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN114511527A (en) | Textile spinning cake forming defect detection method based on expanded local binary pattern | |
CN111223088B (en) | Casting surface defect identification method based on deep convolutional neural network | |
CN108562589B (en) | Method for detecting surface defects of magnetic circuit material | |
CN113643289B (en) | Fabric surface defect detection method and system based on image processing | |
CN108647706B (en) | Article identification classification and flaw detection method based on machine vision | |
CN108181316B (en) | Bamboo strip defect detection method based on machine vision | |
CN112862811A (en) | Material microscopic image defect identification method, equipment and device based on deep learning | |
CN109816648A (en) | Complicated injection-molded item overlap defect identification method based on multi-template low-rank decomposition | |
CN109598681B (en) | No-reference quality evaluation method for image after repairing of symmetrical Thangka | |
CN110781913B (en) | Zipper cloth belt defect detection method | |
CN112270317A (en) | Traditional digital water meter reading identification method based on deep learning and frame difference method | |
CN112102224A (en) | Cloth defect identification method based on deep convolutional neural network | |
CN114494226B (en) | Method for detecting greasy dirt defect of spinning cake based on graph centroid tracking algorithm | |
CN116664565A (en) | Hidden crack detection method and system for photovoltaic solar cell | |
CN112668725A (en) | Metal hand basin defect target training method based on improved features | |
CN116205876A (en) | Unsupervised notebook appearance defect detection method based on multi-scale standardized flow | |
CN114627062A (en) | Solar cell surface defect detection method for improving Faster R-CNN | |
CN116486273B (en) | Method for extracting water body information of small sample remote sensing image | |
CN108596249B (en) | Image feature extraction and classification method and device | |
CN115063679B (en) | Pavement quality assessment method based on deep learning | |
CN114494225A (en) | Paper tube breakage defect detection method based on shape characteristics | |
CN115908261A (en) | Casting X-ray image-based defect rating method and system | |
CN113744241A (en) | Cell image segmentation method based on improved SLIC algorithm | |
Ye et al. | Method for detecting surface defects of ceramic tableware based on deep learning | |
CN112884748A (en) | Non-woven fabric surface small defect detection method based on multi-core support vector machine |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |