A Smart Encoding Method for Fabrics with Large-Size Colored Patterns
By employing steps such as image acquisition, stitching, principal component analysis, and neural network training, the problem of marking the warp and weft yarn intersections in large-size colored fabric patterns was solved, generating highly accurate binary matrix patterns.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-20
- Publication Date
- 2026-03-06
AI Technical Summary
Existing technologies struggle to accurately handle the warp and weft yarn intersections of large-sized colored fabric patterns, resulting in a large amount of annotation work and difficulty in generating binary matrix patterns.
Through steps such as image acquisition, stitching, principal component analysis, neural network training, and connected component analysis, a prediction map of the warp and weft yarn intersections of a large-size colored fabric is generated and converted into a binary matrix pattern.
It achieves high accuracy in generating binary matrix patterns of large-size colored fabrics, reducing annotation workload while maintaining pattern accuracy.
Smart Images

Figure CN116109723B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer vision, and more specifically to a smart encoding method for fabrics with large-sized color patterns. Background Technology
[0002] With the rapid development of modern production technology, the textile industry has undergone tremendous changes. The introduction of intelligent looms has made textile production more convenient, and fabric styles and patterns are becoming increasingly diverse. Intelligent looms can produce fabrics based on binary patterns, which consist of only black and white square units representing two states at the intersection of warp and weft yarns: warp yarns on top of weft yarns and weft yarns on top of warp yarns. In the past, obtaining the corresponding binary pattern for a fabric required significant time and effort from professionals, and this process could potentially damage the fabric. This was unacceptable for historically valuable or precious fabrics. Therefore, automatically annotating warp and weft yarns using deep neural networks to learn from fabric images is a highly significant research area.
[0003] In recent years, such methods have first converted the fabric pattern into a grayscale image of a specific size, then used the U-Net model to generate a predicted warp and weft yarn intersection map corresponding to the fabric pattern, and finally post-processed the predicted warp and weft yarn intersection map to obtain a binary matrix pattern. The predicted warp and weft yarn intersection map is an approximate ternary image, where black and white represent the intersections of warp and weft yarns and respectively represent two opposing top-bottom relationships. Based on these two types of annotation points, it is possible to approximately estimate which yarn is on top for each grid point. Previous methods can accurately generate corresponding annotation maps based on the input fabric image, guiding the generation of binary matrix patterns. However, due to the limitations of the training dataset, previous methods cannot handle large-sized colored fabric patterns. Larger and more extensive datasets are beneficial for model training. In this area of research, annotating the warp and weft yarn intersections for large-sized fabric patterns is quite laborious; the annotation of colored fabric patterns becomes very difficult because the top-bottom relationship of the warp and weft yarns cannot be clearly represented.
[0004] In summary, due to the scarcity of datasets and limitations in model training, it is difficult to directly obtain the binary matrix pattern of large-scale colored fabrics through end-to-end networks. This is a technical problem that researchers in this field urgently need to solve. However, current datasets cannot meet the technical requirements; therefore, providing post-processing methods to compute the binary matrix pattern of large-scale colored fabrics is a pressing issue that needs to be addressed. Summary of the Invention
[0005] To address the aforementioned issues, this invention provides a smart fabric encoding method for large-sized colored patterns. It involves stitching together multiple partial fabric images to obtain a high-resolution complete fabric image, and then generating a binary matrix pattern by using deep learning to obtain the warp and weft yarn intersection markers corresponding to the fabric pattern. This invention obtains a predicted warp and weft yarn intersection map of a large-sized colored fabric pattern with high accuracy, and then uses a connected component analysis algorithm for post-processing to obtain the corresponding binary matrix pattern of the fabric pattern.
[0006] A smart coding method for fabrics with large-size colored patterns includes the following steps:
[0007] Step 1: Use an image acquisition system to acquire high-resolution color patterns of various parts of a large fabric, meaning that the width of the yarns in the fabric pattern is at least 10 pixels.
[0008] Step two involves pre-processing and splicing together the high-resolution color patterns of the fabric parts that are not uniform in size, obtained in step one, to obtain a complete large-size high-resolution color pattern of the large fabric, and then cutting out the central area.
[0009] Step 3: Using principal component analysis, the central area cut out in step 2 is converted into a large-size, high-resolution grayscale fabric pattern.
[0010] Step four: Using an overlapping tiling strategy, the large-size high-resolution grayscale fabric pattern is cut into several smaller grayscale fabric patterns from left to right and from top to bottom with overlap, and these smaller grayscale fabric patterns are divided into a fabric pattern training database and a fabric pattern test database.
[0011] Step 5: Manually label the warp and weft yarn intersections in the fabric pattern training database and train the network model. Calculate and output the corresponding warp and weft yarn intersection prediction map through the network model. Repeat the training until the error between the labeled warp and weft yarn intersection map and the predicted warp and weft yarn intersection map is less than the preset value.
[0012] Step 6: Using a successfully trained network model, input the fabric pattern test database obtained in Step 4, and output a small-sized prediction map of the warp and weft yarn intersections of the fabric.
[0013] Step 7: Using a weighted fusion method, merge several small-sized warp and weft yarn intersection prediction maps from Step 6 to obtain a large-sized warp and weft yarn intersection prediction map.
[0014] Step 8: Using the connected component analysis algorithm and the distance transformation algorithm, the predicted warp and weft yarn intersection point map is binary encoded to obtain a binary matrix pattern.
[0015] Preferably, step two includes the following steps:
[0016] a. Select large-size, high-resolution color patterns from two adjacent fabric sections in sequence, assuming they are left and right adjacent, with the left image being I. left (x, y), the right figure is I right (x, y), where x and y represent the coordinates in the two-dimensional image.
[0017] b. Using the Gaussian function, for the left figure I left (x, y) and Figure I on the right right Applying Gaussian smoothing filters to (x, y) yields results in a space factor of σ∈N. + The following represents L left (x, y) and L right (x, y), N + It represents the set of positive integers.
[0018] c. Calculate L respectively left (x, y) and L right The feature point set of (x, y) is obtained by performing a Scale Invariant Feature Transform (SIFT), and then two matching feature point sets (X, y) are obtained through an optimal matching algorithm. left Y left ) and (X right Y right The mapping transformation between the two sets of points is expressed as: Solve for the homography matrix H using the linear least squares method, and then use H to represent I. right (x, y) transformed to I left The space containing (x, y) yielded a partial image of the fabric after splicing.
[0019] d. Repeat ac to stitch together all the high-resolution color patterns of the collected fabrics with inconsistent sizes. After stitching, cut and retain the complete large-size high-resolution color pattern A of the target large fabric that does not contain edge scene information and only contains fabric information, i.e., the central area.
[0020] Preferably, step three includes the following steps:
[0021] a. Input is a large-size, high-resolution color pattern A of a large fabric; target output is a large-size, high-resolution grayscale pattern A of a large fabric, maintaining the original brightness differences. gray .
[0022] b. Represent the color value of each pixel in the colored pattern A using a set C, i.e., C = {c1, c2, ..., c...} i ..., c n}, where c iLet C represent the color value of the i-th pixel in the color pattern A, traversed in row-major order. The set C contains a total of n pixels, and the average value of all colors is calculated.
[0023] c. Construct the covariance matrix of the color data space represented by C. Perform singular value decomposition and retain the eigenvector w corresponding to the largest eigenvalue. max , that is, the direction of the maximum variance of the color data distribution.
[0024] d, along w max The maximum variance direction projects the colors in three-dimensional space onto a one-dimensional plane, resulting in the transformed grayscale set C. gray =w max C, after normalization, scales the grayscale values to the range of (0, 255), and then C gray The n results are assigned to a blank matrix of the same size as the color pattern A using a row-first traversal, resulting in a large-size, high-resolution grayscale pattern A. gray .
[0025] As a preferred embodiment, the specific process in step five is as follows:
[0026] a. A neural network model consists of two parts: an encoder and a decoder. The encoder performs feature extraction through a series of convolution and pooling operations, while the decoder performs pixel classification through a series of upsampling and skip connection operations.
[0027] b. Manually label the warp and weft yarn intersections in the fabric pattern training database. The input to the network model is a small-sized grayscale fabric pattern, and the output is the predicted warp and weft yarn intersection map corresponding to the fabric pattern calculated by the network.
[0028] c. By rotating the patterns in the fabric pattern training database clockwise by 90°, 180°, and 270° respectively, the size of the fabric pattern training database is expanded to three times its original size.
[0029] d. The error of training the network model is the Euclidean distance between all pixels of the manually annotated warp and weft yarn intersection map and the predicted warp and weft yarn intersection map predicted by the network model. Repeat the training of the network until the error is reduced to within the preset value.
[0030] Preferably, step seven includes the following steps:
[0031] a. Referring to the encoder structure of the neural network model, recursively calculate the receptive field range (rf) of each pixel in the deep features. i =(rf i-1-1)*stride+ksize, i∈[1,m], where the receptive field of each pixel in the current layer is based on the result of the previous layer, which is calculated by the previous layer through convolution or pooling operations. stride represents the stride of the convolution or pooling operation, ksize represents the kernel size of the convolution or pooling operation, and rf i This represents the receptive field size of the i-th layer in the encoder part of the network model. The network has a total of m+1 layers, where rf0 represents the input data layer. The receptive field size of the feature map in the last layer of the encoder is rf. m 1 pixel.
[0032] b. Use size rf m Using a matrix of all ones as a sliding window, the confidence weight of each pixel in the small-sized fabric pattern is calculated from left to right and from top to bottom, starting from the top left corner of the sliding window. This weight is denoted as t. i .
[0033] c. After step six, several small-sized predicted warp and weft yarn intersection points of the fabric are obtained. Following the cutting order, the following weighted fusion algorithm is used: First, two all-zero matrices of the same size as the large-sized grayscale fabric pattern are declared. One is used to record the grayscale value of each position in the large-sized space, denoted as Mat. pv Another is used to record the weight of each location in a large space, denoted as Mat. tv Next, based on the cutting order, the predicted position range of the warp and weft yarn intersection points of each small-sized fabric in the original large-sized space is obtained, while traversing Mat... pv and Mat tv For each position within this range, use a confidence weight t. i And the results within the grayscale value update range of the predicted warp and weft yarn intersection points of small-sized fabrics, if traversing Mat tv When the value at that position is 0, it means that no confidence weight or grayscale value has been calculated for that position. The grayscale value at that position is defined as... The confidence weight is t = t i If the position has already been assigned a value, update its grayscale value. The confidence weight is t = t + t i ; where t i This indicates the confidence weight of the small-size warp and weft yarn intersection prediction map at that location, v i This represents the pixel result of the small-size warp and weft yarn intersection prediction image at that location, where p represents the grayscale value at that location, and t is used to record the confidence weight at that location. The calculated p and t are then used to update Mat. pv and Mat tv middle.
[0034] e. Repeat the weighted fusion algorithm in c until all small-sized fabric warp and weft yarn intersection prediction maps are fused into a large-sized fabric warp and weft yarn intersection prediction map.
[0035] Preferably, step eight includes the following steps:
[0036] a. Thresholding is applied to the prediction map of warp and weft yarn intersections of large-sized fabrics. The preprocessed prediction map of warp and weft yarn intersections retains only three results: black, white, and gray.
[0037]
[0038] Where I0(x, y) represents the grayscale value at position (x, y) after thresholding, Pixel (x,y) This represents the grayscale value before thresholding.
[0039] b. Using the connected component analysis algorithm, traverse each pixel in I0(x,y). For pixels with gray values of 0 and 255 (black and white), with the same gray value as the premise of connectivity, record each connected component in I0(x,y) in a breadth-first search manner. When two or more connected components are adjacent and there is no pixel interval with a gray value of 128 in between, count the gray value with the largest number in these connected components, use this gray value as the correction value for all pixels in these connected components, and modify it into a single connected component, eliminating the erroneous prediction results of black and white coexisting.
[0040] c. Using the erosion algorithm and convolution operation, while keeping the center position unchanged, process all irregular black and white intersection points into square regions.
[0041] d. For all processed black and white intersections, estimate the number and position of warp and weft yarns, and set the center of a black and white grid point of a binary pattern at each estimated warp and weft yarn intersection. Use the type of the nearest black and white intersection as the type of the grid point, and cover the surrounding black and white intersections.
[0042] e. Using a distance transformation algorithm, calculate the distance between each grid point and its nearest grid point in the up, down, left, and right directions based on the type distribution of the intersection points, and obtain the length and width of the grid point, ultimately obtaining the final binary matrix pattern of the fabric.
[0043] Compared with the prior art, the present invention has the following beneficial effects:
[0044] First, an image stitching method based on feature point matching is introduced to stitch together the acquired fabric patterns, overcoming the errors generated during the acquisition process.
[0045] Secondly, a principal component analysis-based technique was used to convert the colored fabric pattern into a grayscale image while preserving the brightness differences of each pixel in the original color image.
[0046] Finally, a weighted fusion method was proposed. Based on the range of the receptive field, the confidence level of each pixel in the prediction map of warp and weft yarn intersections output by the network model was derived, providing a reference for the fusion of prediction maps of warp and weft yarn intersections of various small sizes. The binary encoding of large-size colored fabric patterns was completed, and the binary matrix pattern of large-size colored fabric patterns was obtained. Attached Figure Description
[0047] To more clearly illustrate the technical solutions of this invention, the accompanying drawings will be provided below for a brief description of the technical applications in this invention, which will give those skilled in the art a clearer understanding of the performance of this technology.
[0048] Figure 1 This demonstrates the processing flow for obtaining the corresponding binary matrix pattern of the fabric in this invention;
[0049] Figure 2 This is a diagram of the neural network model structure used in this invention. Detailed Implementation
[0050] The core of this invention is to provide a smart encoding method for fabrics with large-size colored patterns. This allows textile industry professionals and researchers to obtain the binary code of fabrics more efficiently. To further illustrate this invention in detail, specific examples and accompanying drawings are provided below.
[0051] refer to Figure 1 , Figure 1 The flowchart of the process from fabric pattern to corresponding binary matrix pattern in this invention includes the following steps:
[0052] Step 1: Use an image acquisition system to acquire high-resolution color patterns of various parts of a large fabric.
[0053] Step 2: Using the high-resolution color pattern of the fabric with inconsistent sizes acquired in Step 1 as input, after preprocessing and splicing, a complete high-resolution color pattern of the large fabric is obtained. Large size means that the length and width are at least 8000 pixels and the number of warp and weft yarns does not exceed 800. The complete high-resolution color pattern of the large fabric is cut out, and only the central part containing the target fabric is retained to obtain a large-size fabric color image, ensuring that there are no other interfering pixels in the color space of the image.
[0054] 2.1 Select large-size, high-resolution color patterns from two adjacent fabric sections in sequence, assuming they are left and right adjacent. The left image is I. left (x, y), the right figure is I right (x, y), where x and y represent the coordinates in the two-dimensional image.
[0055] 2.2 Using the Gaussian function For left figure I left (x, y) and Figure I on the right right Applying Gaussian smoothing filters to (x, y) yields results in a space factor of σ∈N. + The following represents L left (x, y) and L right (x, y), i.e., L left (x, y) = G(x, y, σ) * I left (x, y) and L right (x, y) = G(x, y, σ) * I right (x, y), where Where σ represents the scale space, x and y represent the two-dimensional positions, and G(x, y, σ) can generate a set of Gaussian templates centered at (x, y) with variance σ that conform to a Gaussian distribution. * represents the convolution operation, σ represents the spatial factor, and N + It represents the set of positive integers.
[0056] 2.3 Calculate L separately left (x, y) and L right The feature point set of (x, y) is obtained by performing a Scale-Invariant Feature Transform (SIFT), and then two matching feature point sets (X, y) are obtained through an optimal matching algorithm. left Y left ) and (X right Y right The mapping transformation between the two sets of points is expressed as: Solve for the homography matrix H using the linear least squares method, and then use H to represent I. right (x, y) transformed to I left The space containing (x, y) yielded a partial image of the fabric after splicing.
[0057] 2.4 Repeat steps 2.1-2.3 to stitch together all the high-resolution color patterns of the collected fabrics with inconsistent sizes. After stitching, cut and retain the complete large-size high-resolution color pattern A of the target large fabric, which does not contain edge scene information and only contains fabric information, i.e., the central area.
[0058] Step 3: Using principal component analysis, the central area cut out in step 2 is converted into a large-size, high-resolution grayscale fabric pattern.
[0059] 3.1 Input is a large-size, high-resolution color pattern A of a large fabric; target output is a large-size, high-resolution grayscale pattern A of a large fabric while maintaining its original brightness differences. gray .
[0060] Represent the color value of each pixel in the colored pattern A using a set C, i.e., C = {c1, c2, ..., c...}. i ..., c n}, where c i Let C represent the color value of the i-th pixel in the color pattern A, traversed in row-major order. The set C contains a total of n pixels, and the average value of all colors is calculated.
[0061] 3.2 Construct the covariance matrix of the color data space represented by C. Perform singular value decomposition and retain the eigenvector w corresponding to the largest eigenvalue. max , that is, the direction of the maximum variance of the color data distribution.
[0062] 3.3, along w max The maximum variance direction projects the colors in three-dimensional space onto a one-dimensional plane, resulting in the transformed grayscale set C. gray =w max C, after normalization, scales the grayscale values to the range of (0, 255), and then C gray The n results are assigned to a blank matrix of the same size as the color pattern A using a row-first traversal, resulting in a large-size, high-resolution grayscale pattern A. gray .
[0063] Step 4: Using an overlapping tiling strategy, the large-size high-resolution grayscale fabric pattern is cut into several smaller grayscale fabric patterns with overlapping dimensions from left to right and from top to bottom. The smaller grayscale fabric patterns are 500 pixels in size and are divided into a fabric pattern training database and a fabric pattern test database.
[0064] Step 5: Manually label the warp and weft yarn intersections in the fabric pattern training database and train the network model. Calculate and output the corresponding warp and weft yarn intersection prediction map through the network model. Repeat the training until the error between the labeled warp and weft yarn intersection map and the predicted warp and weft yarn intersection map is less than the preset value.
[0065] 5.1 The neural network model consists of two parts: an encoder and a decoder. The encoder completes the feature extraction task through a series of convolution and pooling operations. Convolution is used to locate features, and pooling is used to compress feature maps, expand the receptive field, extract contextual information of features, and accelerate network convergence. The decoder completes the pixel classification task through a series of upsampling and skip connection operations. Upsampling is used to restore the resolution of the feature map, and skip connections are used to stitch together and fuse the positional and semantic information of features at the same resolution.
[0066] The network structure is shown in Figure 2. The encoder part consists of five convolutional and pooling layers to the left of the first upsampling operation. The convolutional size is 3, and the padding is 1 to ensure that the feature map size of the same layer remains unchanged after the convolutional operation. Each layer goes through two convolutional operations and then enters the next layer through max pooling. The decoder part includes the five-layer structure to the right of the first upsampling operation. Each layer operation of the decoder includes the output of the previous layer being upsampled and the same size layer in the encoder being copied and spliced into the input of each layer of the decoder after skip connection. Then, it goes through two convolutional operations. All the small-sized grayscale fabric patterns obtained in step 5 are used to calculate the small-sized warp and weft yarn intersection prediction map using the trained neural network model as described in step 5 of the invention.
[0067] The fabric pattern training database is manually labeled with warp and weft yarn intersections. In the intersection labeling map, black represents the intersection of warp yarns on top of weft yarns, white represents the intersection of weft yarns on top of warp yarns, and gray represents the background. The input to the network model is a small-sized grayscale fabric pattern, and the output is the predicted warp and weft yarn intersection map corresponding to the fabric pattern calculated by the network.
[0068] 5.2 By rotating the patterns in the fabric pattern training database clockwise by 90°, 180°, and 270° respectively, the size of the fabric pattern training database is increased to three times its original size.
[0069] 5.3 The training error of the network model is the Euclidean distance between all pixels of the manually annotated warp and weft yarn intersection map and the predicted warp and weft yarn intersection map predicted by the network model. Repeat the training of the network until the error is reduced to less than 1000.
[0070] Step 6: Using a trained network model, input the fabric pattern test database obtained in Step 4, and output a small-sized prediction map of the warp and weft yarn intersections.
[0071] Step 7: Using a weighted fusion method, merge several small-sized warp and weft yarn intersection prediction maps from Step 6 to obtain a large-sized warp and weft yarn intersection prediction map.
[0072] 7.1 Referring to the encoder structure of the neural network model, recursively calculate the receptive field range (rf) of each pixel in the deep features. i =(rf i-1 -1)*stride+ksize, i∈[1,m], where the receptive field of each pixel in the current layer is based on the result of the previous layer, which is calculated by the previous layer through convolution or pooling operations. stride represents the stride of the convolution or pooling operation, ksize represents the kernel size of the convolution or pooling operation, and rf iThis represents the receptive field size of the i-th layer in the encoder part of the network model. The network has a total of m+1 layers, where rf0 represents the input data layer. The receptive field size of the feature map in the last layer of the encoder is rf. m 1 pixel.
[0073] 7.2, Use size rf m Using a matrix of all ones as a sliding window, the confidence weight of each pixel in the small-sized fabric pattern is calculated from left to right and from top to bottom, starting from the top left corner of the sliding window and centering on the small-sized fabric pattern. Specifically, the weight is the ratio of the area of overlap between the sliding window and the pattern to the area of the sliding window itself when the center of the sliding window is at that pixel, denoted as t. i , which is the confidence weight, where the closer a pixel is to the center of the image, the greater its confidence weight, and the closer it is to the boundary, the smaller its weight.
[0074] 7.3 After step six, several small-sized predicted warp and weft yarn intersection points of the fabric are obtained. Following the cutting order, the following weighted fusion algorithm is used: First, two all-zero matrices of the same size as the large-sized grayscale fabric pattern are declared. One is used to record the grayscale value of each position in the large-sized space, denoted as Mat. pv Another is used to record the weight of each location in a large space, denoted as Mat. tv Next, based on the cutting order, the predicted position range of the warp and weft yarn intersection points of each small-sized fabric in the original large-sized space is obtained, while traversing Mat... pv and Mat tv For each position within this range, use a confidence weight t. i And the results within the grayscale value update range of the predicted warp and weft yarn intersection points of small-sized fabrics, if traversing Mat tv When the value at that position is 0, it means that no confidence weight or grayscale value has been calculated for that position. The grayscale value at that position is defined as... The confidence weight is t = t i If the position has already been assigned a value, update its grayscale value. The confidence weight is t = t + t i ; where t i This indicates the confidence weight of the small-size warp and weft yarn intersection prediction map at that location, v i This represents the pixel result of the small-size warp and weft yarn intersection prediction image at that location, where p represents the grayscale value at that location, and t is used to record the confidence weight at that location. The calculated p and t are then used to update Mat. pv and Mat tv middle.
[0075] 7.4 Repeat the weighted fusion algorithm in 7.3 until all small-sized fabric warp and weft yarn intersection prediction maps are fused into a large-sized fabric warp and weft yarn intersection prediction map.
[0076] Step 8: Using the connected component analysis algorithm and the distance transformation algorithm, the predicted warp and weft yarn intersection point map is binary encoded to obtain a binary matrix pattern.
[0077] 8.1. Thresholding is performed on the prediction map of warp and weft yarn intersections of large-sized fabrics. The preprocessed prediction map of warp and weft yarn intersections retains only three results: black, white, and gray.
[0078]
[0079] Where I0(x, y) represents the grayscale value at position (x, y) after thresholding, Pixel (x,y) This represents the grayscale value before thresholding.
[0080] 8.2 Using the connected component analysis algorithm, traverse each pixel in I0(x,y). For pixels with gray values of 0 and 255 (black and white), with the same gray value as a prerequisite for connectivity, record each connected component in I0(x,y) in a breadth-first search manner. When two or more connected components are adjacent without any pixel interval of gray value 128 in between, count the gray value with the largest number in these connected components, use this gray value as the correction value for all pixels in these connected components, and modify it into a single connected component, eliminating erroneous prediction results where black and white coexist.
[0081] 8.3 Using the erosion algorithm and convolution operation, while keeping the center position unchanged, all irregular black and white intersection points are processed into square regions.
[0082] 8.4. For all processed black and white intersections, estimate the number and position of warp and weft yarns, and set the center of a black and white grid point of a binary pattern at each estimated warp and weft yarn intersection. Use the type of the nearest black and white intersection as the type of the grid point, and cover the surrounding black and white intersections.
[0083] 8.5. Using the distance transformation algorithm, calculate the distance of each grid point to its nearest grid point in the up, down, left, and right directions according to the type distribution of the intersection points, and obtain the length and width of the grid point. Finally, obtain the final binary matrix pattern of the fabric.
[0084] The above description is merely a basic embodiment of the present invention, and is intended only to help understand the technical solution and core ideas of the present invention. It should be noted that those skilled in the art can make various improvements and modifications to the present invention without departing from its principles, and these improvements and modifications also fall within the protection scope of the claims of the present invention.
Claims
1. A fabric intelligent coding method for large size color pattern, characterized in that, The method comprises the following steps: Step one, using an image acquisition system to collect high-resolution color patterns of each part of the fabric; Step two, the collected high-resolution color patterns are preprocessed and spliced, and the center area is cut out; Step three, using principal component analysis algorithm, the center area is converted into high-resolution gray fabric pattern; Step four, using the strategy of overlapping tiling, the high-resolution gray fabric pattern is cut into multiple gray fabric patterns with overlapping from left to right and from top to bottom, and the fabric pattern training database and the fabric pattern test database are divided; Step five, the warp and weft yarn intersection points of the fabric pattern training database are labeled, and the network model is trained, the corresponding warp and weft yarn intersection point prediction map is calculated by the network model, and the network is repeatedly trained until the error between the warp and weft yarn intersection point labeling map and the warp and weft yarn intersection point prediction map is less than the preset value; The network model comprises an encoder and a decoder, wherein the encoder completes the feature extraction task through convolution and pooling operation, and the decoder completes the pixel classification task through upsampling and jump connection operation; Step six, using the trained network model, input the fabric pattern test database, and output the corresponding fabric warp and weft yarn intersection point prediction map; Step seven, using the weighted fusion method, the fabric warp and weft yarn intersection point prediction map output in step six is fused, comprising the following steps: 7.1, recursively calculate the receptive field range of each pixel of the deep feature, that is , , where represents the step size of convolution or pooling, represents the kernel size of convolution or pooling, represents the receptive field size of the network model encoder part layer, the network model has layers, represents the input data layer, and the receptive field size of the feature map of the last layer of the encoder is pixels; 7.2, using a full 1 matrix of size as a sliding window, the confidence weight of each pixel of the cropped gray fabric pattern is calculated from left to right and from top to bottom with the center of the sliding window starting from the top left corner of the cropped gray fabric pattern ; 7.3、After step six, get several fabric warp and weft yarn intersection point prediction maps, use the following weighted fusion algorithm according to the cutting order, first declare two all-0 matrices of the same size as the gray fabric pattern, one is used to record the gray value of each position in the space, denoted as , the other is used to record the weight of each position in the space, denoted as ; second, get the position range of each fabric warp and weft yarn intersection point prediction map in the original space according to the cutting order, and simultaneously traverse each position in the range of and , respectively update the result in the range with the confidence weight and the gray value of the fabric warp and weft yarn intersection point prediction map. If traversing , the value of the position is 0, representing that the position has not been calculated the confidence weight and the gray value, defining the gray value of the position as , the confidence weight as ; if the position has been assigned, updating the gray value of the position as , the confidence weight as ; wherein represents the pixel result of the intersection point prediction image at the position, represents the gray value of the position, is used to record the confidence weight of the position, and the calculated and are updated to and respectively; 7.4, repeat the weighted fusion algorithm of step 7.3 until all fabric warp and weft yarn intersection point prediction maps are fused into one fabric warp and weft yarn intersection point prediction map; Step eight, using connected component analysis algorithm and distance transform algorithm, the fused warp and weft yarn intersection point prediction map is binary coded to obtain a binary matrix pattern.
2. The method for fabric intelligent coding facing large size color pattern according to claim 1, characterized in that, The step two comprises the following specific steps: 2.1, sequentially select two adjacent fabric part high-resolution color patterns, assume left and right adjacent, left picture is , right picture is , where represents the coordinates in the two-dimensional image; 2.2, using Gaussian function, the left figure and the right figure are respectively made Gaussian smoothing filter, get in the space factor is under the expression and , represent a set of positive integers; 2.3, respectively calculate and The feature point set of the scale invariant feature transformation, and then get the two sets of feature points matched by the best matching algorithm and The mapping transformation of the two sets of points is expressed as: The homography matrix is solved by linear least square method Transform to the space where is located, and get the spliced partial fabric image; 2.4, repeat 2.1-2.3 to stitch all the collected high-resolution color patterns, and after stitching, crop to retain the target high-resolution color pattern that does not contain edge scene information, only fabric information i.e. the central region.
3. The method of claim 2, wherein the fabric is a large size color pattern oriented fabric. The step three comprises the following steps: 3.
1. Represent the color value of each pixel in a high-resolution color pattern by a set , i.e. where denotes the color value of the th pixel in row-major order traversal of the set , the set contains a total of pixels, and the average value of all colors is calculated as ; 3.2, Construction Covariance matrix of the represented color data space and singular value decomposition is done, keeping the eigenvector corresponding to the largest eigenvalue i.e. the direction of the largest variance of the color data distribution; 3.3, along The maximum variance direction projects colors from three-dimensional space onto a one-dimensional plane, resulting in a converted grayscale set. After normalization, the grayscale values are scaled down to Within the range, then within The results are assigned to the array in row-first order. A high-resolution grayscale pattern is obtained from a blank matrix of the same size. .
4. The fabric intelligent coding method for large size color pattern according to claim 3, characterized in that, The specific process in step five is as follows: 4.1, manually label the warp and weft yarn intersection points of the fabric pattern training database, the input of the network model is the cut gray fabric pattern, and the output is the warp and weft yarn intersection point prediction map of the fabric pattern calculated by the network model; 4.2, the size of the fabric pattern training database is expanded to three times by rotating the patterns in the fabric pattern training database by 90°, 180° and 270° clockwise respectively; 4.3, the error of the neural network model is the Euclidean distance between the manually labeled warp and weft yarn intersection points and the warp and weft yarn intersection point prediction map predicted by the network model, and the network is repeatedly trained until the error is reduced to within the preset value.
5. The method for fabric intelligent coding facing large size color pattern according to claim 4, characterized in that, The confidence weight in step 7.2 is specifically the ratio of the area of the sliding window overlapping the pattern to the area of the sliding window, denoted as , the closer to the center of the image, the larger the pixel confidence weight, and the closer to the border, the smaller the weight.
6. The method for fabric intelligent coding for large size color pattern according to claim 1, characterized in that, The step eight comprises the following steps: 8.1, threshold processing is performed on the fused fabric warp and weft yarn intersection point prediction map, and the warp and weft yarn intersection point prediction map is preprocessed to only keep three results of black, white and gray, that is: ; wherein representative position thresholded gray value, representative gray value before thresholding 8.2, using connected component analysis algorithm, traversing each pixel, for the pixels with gray value of 0 and 255, taking the same gray value as the connected premise, recording in the breadth-first search mode each connected component, when there are two or more connected components adjacent without the pixel interval with gray value of 128 in between, counting the gray value with the largest quantity in these connected components, taking the gray value as the correction value of all pixels in these connected components, and modifying to one connected component, eliminating the error prediction result of black and white coexistence; 8.3, using erosion algorithm and convolution operation, all irregular black and white intersection points are processed into square regions while keeping the center position unchanged; 8.4, Estimate the number and position of warp and weft yarns for all processed black and white intersections, and set the center of each black and white grid point in a binary pattern at each estimated warp and weft intersection, taking the type of the nearest black and white intersection as the type of the grid point, and covering the surrounding black and white intersections; 8.5, Using the distance transform algorithm, calculate the distance of each grid point from the nearest grid point in the up, down, left and right directions according to the type distribution of the black and white intersections, obtain the length and width of the grid point, and finally obtain the final binary matrix pattern of the fabric.
Citation Information
Patent Citations
Crime prediction method based on intertwining time sequence local connection recurrent neural network
CN107563122A
Intersection detection and classification in autonomous machine applications
WO2020185779A1