Knitted fabric texture circulation primitive segmentation method and device based on deep learning
Through a deep learning-based method, multi-scale feature extraction and Hough voting space analysis were used to solve the problem of tissue recurrent primitive segmentation in knitted fabrics, and high-precision and efficient fabric recurrent primitive segmentation were achieved.
Patent Information
- Application Number
- CN202411524668.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-29
- Publication Date
- 2025-03-25
AI Technical Summary
The prior art is difficult to accurately segment the tissue circulation primitives in knitted fabrics of complex structures, resulting in low recognition rates and inability to apply to most fabrics.
Using a deep learning-based method, the MSS-VGG19 model was used to perform multi-scale feature extraction, screen peak points, construct Hough voting space, determine the recurrent primitive size, and segment the recurrent primitives of fabric organization through the center of mass coordinates.
It improves the accuracy and efficiency of fabric tissue circulating primitive segmentation, can more effectively capture the characteristic details of fabric tissue, shorten the calculation time and improve the recognition accuracy.
Smart Images

Figure CN119693399A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a method for segmenting fabric structure cyclic primitives, and in particular to a method and device for segmenting knitted fabric structure cyclic primitives based on deep learning. Background Art
[0002] In the fields of textile fabric production design, quality control, performance analysis and texture recognition, it is a crucial process to accurately segment the weave loop primitives of knitted fabrics. Only by accurately identifying the weave loop primitives can we effectively classify the weave structure and draw the design map.
[0003] At present, there are two main methods for computer vision to identify cyclic patterns: database-based recognition algorithms and adaptive processing-based algorithms. Database-based recognition methods use matching or classification algorithms to compare and match the fabric to be identified with the knitting patterns or their repetitive categories pre-entered in the database, and calculate the similarity. The adaptive algorithm-based method can be further divided into fabric image processing technology based on image features and methods specifically targeting the characteristics of knitting patterns, aiming to achieve efficient recognition of fabric patterns without relying on a large database.
[0004] Meng et al. designed a multi-task multi-scale convolutional neural network (MSnet) to predict the location of yarns and weave points, and then identify the fabric weave point categories and draw design maps; Lettry et al. used a pre-trained convolutional neural network (CNN) model to extract multi-scale features when studying repetitive patterns in natural scenes. By identifying peak points and further processing, a gridded segmented image was successfully generated, which effectively detects and analyzes periodic patterns in natural scenes. These previous studies have focused on applying digital image processing technology, which is usually only applicable to fabrics with simple patterns. When it comes to knitted fabrics with complex and varied structures, it becomes particularly difficult to accurately segment the weave elements, and so far there has not been a widely applicable, efficient and practical method.
[0005] In order to solve the above problems, people have been seeking an ideal technical solution. Summary of the invention
[0006] The purpose of the present invention is to address the deficiencies in the prior art and to provide a method and device for knitted fabric structure cyclic primitive segmentation based on deep learning, which can successfully identify most fabrics with simple patterns and provide an accurate and efficient solution for high-precision fabric structure cyclic primitive segmentation.
[0007] In order to achieve the above object, the technical solution adopted by the present invention is: a knitted fabric tissue cycle primitive segmentation method based on deep learning, comprising the following steps:
[0008] Obtain a knitted fabric image, use the trained MSS-VGG19 model to perform multi-scale feature extraction on the knitted fabric image, and obtain multiple feature maps;
[0009] The peak points are screened out in each extracted feature map, a Hough voting space is constructed according to the distance between the peak points, and voting is performed in the Hough voting space to obtain the size of the cyclic primitive;
[0010] Filter out the best feature map based on the size of the cyclic primitive, and calculate the centroid coordinates of the cyclic primitive in the best feature map;
[0011] The knitted fabric structure loop primitives are segmented based on the centroid coordinates.
[0012] Preferably, a Hough voting space is constructed according to the distance between the peak points, and the steps of voting in the Hough voting space to obtain the size of the cyclic primitive are:
[0013] Define each set of peak points as p i , p j ∈P l , P l is the set of peak points of the lth feature map; i, j is the position of the peak points of this group in the lth feature map;
[0014] According to d ij :|p i -p j |,i1j calculates the displacement vector d ij , construct the displacement set D l ={d ij}, where || is the absolute value of the vector;
[0015] Take each bit of the displacement vector d as the displacement set ij is the mean, and the covariance matrix is Construct a two-dimensional normal distribution; where σ l The calculation formula is:
[0016] σ l =(image.size(2) / l.size(1)) / 2
[0017] Where, image represents the knitted fabric image, image.size(2) represents the third dimension of the knitted fabric image, and l.size(1) represents the second dimension of the lth feature map;
[0018] Calculate the probability density value V through the two-dimensional normal distribution functionl,i,j :
[0019]
[0020] Where V l,i,j Represents the two-dimensional normal distribution probability density value of (i, j) in the lth feature map;
[0021] Construct the Hough voting space V according to the probability density function:
[0022]
[0023] Preferably, the step of screening out peak points in each extracted feature map includes:
[0024] Resize the feature map to the original knitted fabric image size;
[0025] Perform edge detection on the adjusted feature map, and smooth the image by Gaussian filtering and maximum filtering;
[0026] The peak point detection method is used to obtain the peak point in the feature map.
[0027] Preferably, the steps of selecting the best feature graph based on the size of the cyclic primitive and calculating the centroid coordinates of the cyclic primitive in the best feature graph include:
[0028] The displacement set corresponding to each feature map is screened using the size of the cyclic primitive to obtain the best displacement set;
[0029] Select the feature layer corresponding to the displacement set with the largest number of consistent displacement vectors in the optimal displacement set as the optimal feature map;
[0030] The center-of-mass coordinates and displacement vector in the best feature map are modulo calculated, and then the offset is obtained through the offset calculation formula. The center-of-mass coordinates with the minimum offset are the center-of-mass coordinates of the cyclic primitive.
[0031] Preferably, the step of segmenting the knitted fabric structure cycle primitives based on the centroid coordinates comprises:
[0032] Based on the obtained centroid coordinates, the optimal horizontal and vertical lines are obtained using mathematical fitting methods;
[0033] The nodes of the grid are determined according to the optimal horizontal and vertical straight lines to form a two-dimensional grid.
[0034] Preferably, the MSS-VGG19 model includes 16 convolutional layers with a multi-branch structure, 1 spatial pyramid pooling layer and 3 fully connected layers, the multi-branch structure includes a main branch with a 3×3 convolution kernel, an auxiliary branch with a 1×1 convolution kernel and a branch that only contains batch normalization operations; the fully connected layer is compressed using SVD matrix decomposition.
[0035] A second aspect of the present invention provides a knitted fabric structure cycle primitive segmentation device based on deep learning, comprising:
[0036] A feature extraction module is used to obtain a knitted fabric image and to perform multi-scale feature extraction on the knitted fabric image using a trained MSS-VGG19 model to obtain multiple feature maps;
[0037] The primitive size determination module is used to screen out the peak points in each extracted feature map, construct the Hough voting space according to the distance between the peak points, and perform voting in the Hough voting space to obtain the cyclic primitive size;
[0038] A primitive centroid coordinate acquisition module is used to select the best feature map based on the size of the cyclic primitive and calculate the centroid coordinates of the cyclic primitive in the best feature map;
[0039] The primitive segmentation module segments the knitted fabric structure loop primitives based on the centroid coordinates.
[0040] A third aspect of the present invention provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method proposed in the first aspect when executing the computer program.
[0041] A fourth aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method proposed in the first aspect.
[0042] A fifth aspect of the present invention provides a computer program product, comprising a computer program, which implements the steps of the method proposed in the first aspect when executed by a processor.
[0043] The present invention has outstanding substantial features and significant progress compared with the prior art. Specifically, the present invention extracts multi-level features of fabric images through the MSS-VGG19 deep learning model, screens out the peak points in the feature map, and obtains a set of primitive size data by calculating the distance between these peak points; finally, the Hough voting algorithm is used to determine the optimal tissue cycle primitive size from these data; based on the optimal tissue cycle primitive size, a set of the most critical feature layers are selected for processing, and the corresponding centroid coordinate set is obtained by voting; finally, based on the obtained centroid coordinate set, a mathematical fitting method is used to obtain the optimal horizontal and vertical straight lines, and the nodes of the grid are established through these straight lines, thereby forming an accurate two-dimensional grid.
[0044] The multi-scale feature extraction method using the MSS-VGG19 model can more effectively capture the feature details of the fabric weave loop primitives, thereby improving segmentation accuracy; and reducing the number of feature maps, which greatly reduces the amount of subsequent algorithm calculations and improves the overall running time;
[0045] Based on the optimal organizational cycle primitive size, a group of the most critical feature layers are selected for processing, which not only significantly reduces the amount of calculation, but also does not affect the accuracy of the algorithm. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 It is a schematic diagram of the process of the method described in Example 1.
[0047] Figure 2 This is a comparison chart before and after the improvement of the convolutional layer in Example 1.
[0048] Figure 3 This is a schematic diagram of the size of the feature map extracted by MSS-VGG19 in Example 1.
[0049] Figure 4 It is a schematic diagram of the process of screening peak points described in Example 1.
[0050] Figure 5 This is a schematic diagram of the primitive size calculation process described in Example 1.
[0051] Figure 6 It is a segmentation comparison diagram obtained by using the AlexNet network and the MSS-VGG19 model in the verification embodiment.
[0052] Figure 7 It is a segmentation result obtained by verifying the method based on the homogeneous value of the sum and difference histogram in the embodiment.
[0053] Figure 8 It is the segmentation result obtained based on the printing pattern segmentation method in the verification embodiment.
[0054] Fig. 9 This is a functional block diagram of the system described in Example 2. DETAILED DESCRIPTION
[0055] In the process of in-depth analysis of fabric technology, many key parameters must be accurately measured, including fabric size, weave structure intention, weave classification, and gram weight. If the weave cycle unit of the fabric can be effectively separated independently, and the weave point design map can be drawn and the weave points can be classified based on this, the entire analysis process will be greatly simplified. However, traditional methods based on digital image processing have many unsolvable problems. They cannot uniformly process a variety of complex fabrics, have relatively low recognition rates, and cannot completely overcome the effects of lighting, tilt, noise, etc., so they are not widely used in practical applications.
[0056] Therefore, the present invention focuses on the segmentation of fabric tissue cycle primitives in order to improve the efficiency and accuracy of process analysis. First, multi-scale features are mainly extracted through MSS-VGG19, and then the peak points are screened, and then the primitive size is voted based on the Hough space, and finally the fabric tissue cycle primitives are accurately segmented. By comprehensively considering the characteristics of the fabric structure at different scales, the tissue cycle primitives are more carefully identified and divided, thereby providing a solid foundation for the intention and classification of drawing tissue points. This multi-scale approach allows the subtle differences of fabrics to be captured at all levels, ensuring the comprehensiveness and accuracy of tissue cycle analysis. In addition, in order to address the limitations of the original algorithm in terms of execution efficiency, the present invention has made detailed improvements to the model and algorithm, thereby significantly optimizing the accuracy of primitive segmentation. Through these improvements, not only the speed of the analysis process is improved, but also the high accuracy of the results is ensured, providing a more efficient and reliable method for the segmentation of fabric tissue cycle primitives.
[0057] The technical solution of the present invention is further described in detail below through specific implementation methods.
[0058] Example 1
[0059] This embodiment provides a knitted fabric tissue cycle primitive segmentation method based on deep learning. Figure 1 As shown, the following steps are included:
[0060] The knitted fabric image is obtained, and the trained MSS-VGG19 model is used to extract multi-scale features of the knitted fabric image to obtain multiple feature maps.
[0061] In one embodiment, the MSS-VGG19 model includes 16 layers of convolutional layers with a multi-branch structure, 1 layer of spatial pyramid pooling layer and 3 layers of fully connected layers, the multi-branch structure includes a main branch with a 3×3 convolution kernel, an auxiliary branch with a 1×1 convolution kernel and a branch that only contains batch normalization operations; the fully connected layer is compressed using SVD matrix decomposition.
[0062] The core idea of the fabric tissue cyclic primitive segmentation algorithm is to use convolutional neural networks to deeply explore the deep features of fabric images, and automatically find the inherent laws related to fabrics in these feature maps to achieve fabric tissue cyclic primitive segmentation. This embodiment uses MSS-VGG19 as the core framework to construct a deep convolutional neural network. The network inputs a single-channel grayscale image of size 512×512, and extracts the deep features of the image through a series of convolution, pooling, normalization and ReLU activation function operations. Then, spatial pyramid pooling is used to process pictures of different sizes, and then these features are passed to the fully connected layer. In order to reduce the computational burden, the fully connected layer uses SVD (singular value decomposition) technology for matrix decomposition. At the same time, in order to reduce overfitting, the Dropout technology is introduced, and the random inactivation ratio is set to 0.7, which helps to further streamline the model parameters.
[0063] Specifically, the improved network parameters are shown in Table 1 below, where Block 1, Block 2, and Block 3 each include two multi-branch structures, and Block 4 and Block 5 each include four multi-branch structures.
[0064] Table 1 Network parameters
[0065] layer type Output Channel Convolution Kernel Step Length C1 Block1 64 3×3 1 S1 MaxPool1 64 2×2 2 C2 Block2 128 3×3 1 S2 MaxPool2 128 2×2 2 C3 Block3 256 3×3 1 S3 MaxPool3 256 2×2 2 C4 Block4 512 3×3 1 S4 MaxPool4 512 2×2 2 C5 Block5 512 3×3 1 S5 MaxPool5 512 2×2 2 S6 SPP 10752 F1 FC7 1024 F2 FC8 64 F3 FC9 2
[0066] The model contains 16 convolutional layers with multi-branch structures, 1 spatial pyramid pooling layer and 3 fully connected layers. Max-pooling is used to separate the layers, and the ReLU activation function is used. It reduces the number of parameters by stacking multiple 3×3 convolution kernels instead of large convolution kernels, and uses a multi-branch structure to optimize the overall network performance and enhance nonlinear mapping and network fitting capabilities.
[0067] Specifically, since the multi-branch structure can significantly enhance the representation ability of the model, this embodiment introduces it into the convolution module in the VGG19 model. Specifically, the standard 3×3 convolution module is upgraded to a composite multi-branch structure, which includes a main branch using a 3×3 convolution kernel, supplemented by a branch with a 1×1 convolution kernel and a branch that only contains batch normalization operations, and then the calculation results of the three are fused together. This design aims to capture feature information of different scales and enhance the overall representation ability of the network through multi-branch parallel processing. The original convolution module and the replaced multi-branch structure are shown in Figure 2. Figure 2 shown.
[0068] Among them, a spatial pyramid pooling layer is added before the fully connected layer, which can make the input image size no longer limited.
[0069] Given that the VGG19 model has a large number of layers, its computational workload is huge and it does not have an advantage in processing speed. In addition, the dimension of the feature vector output by the convolutional layer is extremely high. If the conventional fully connected layer method is used, the required computational workload will be very large. For example, if the dimension of the first fully connected layer is (25088×4096), then the required computational workload will reach 25088×4096=102760448. By applying SVD matrix decomposition, this layer can be decomposed into two matrices of (25088×1024) and (1024×4096), and the computational workload becomes 25088×1024+1024×4096=29884416. Therefore, using SVD matrix decomposition can significantly reduce the computational burden of the fully connected layer, reduce the running time of the model, and effectively achieve the purpose of optimizing model performance. The size of the feature map obtained by multi-scale feature extraction with the improved network structure is as follows: Figure 3 shown.
[0070] It is understandable that before performing multi-scale feature extraction on the knitted fabric image, the knitted fabric image may be preprocessed, such as equalization processing, interpolation processing, etc., to improve the feature extraction effect.
[0071] Knitted fabrics with cyclic primitives have the characteristics of repetition. After the knitted fabric image is input into the MSS-VGG19 model, regular peak points will be generated between different feature layers. Each group of peak points corresponds to a displacement vector. The absolute value of the displacement vector that appears most frequently in different feature layers is the size of the cyclic primitive.
[0072] The specific steps are as follows: filter out the peak points in each extracted feature map, construct the Hough voting space according to the distance between the peak points, and vote in the Hough voting space to obtain the size of the cyclic primitive.
[0073] In a specific embodiment, Figure 4 As shown, the steps of screening out peak points in each extracted feature map include:
[0074] Resize the feature map to the original knitted fabric image size;
[0075] Perform edge detection on the adjusted feature map, and smooth the image by Gaussian filtering and maximum filtering;
[0076] A peak point detection method is used to obtain the peak points in the feature map; preferably, the peak point detection method adopts a non-maximum suppression algorithm.
[0077] In a specific embodiment, Figure 5 As shown, the Hough voting space is constructed according to the distance between the peak points, and the steps of voting in the Hough voting space to obtain the size of the cyclic primitive are:
[0078] Define each set of peak points as p i , p j ∈P l , P l is the set of peak points of the lth feature map; i, j is the position of the peak points of this group in the lth feature map;
[0079] According to d ij :|p i -p j |,i1j calculates the displacement vector d ij , construct the displacement set D l ={d ij}, where || is the absolute value of the vector;
[0080] Take each bit of the displacement vector d as the displacement set ij is the mean, and the covariance matrix is Construct a two-dimensional normal distribution, where σ l The calculation formula is:
[0081] σ l =(image.size(2) / l.size(1)) / 2
[0082] Where, image represents the knitted fabric image, image.size(2) represents the third dimension of the knitted fabric image, and l.size(1) represents the second dimension of the lth feature map;
[0083] Calculate the probability density value V through the two-dimensional normal distribution function l,i,j :
[0084]
[0085] Where V l,i,jRepresents the two-dimensional normal distribution probability density value of (i, j) in the lth feature map;
[0086] Construct the Hough voting space V according to the probability density function:
[0087]
[0088] In the Hough voting space V, the horizontal maximum value and the vertical maximum value are selected as the cycle primitive size (d x ,d y ).
[0089] After obtaining the size of the cyclic primitive, it is necessary to further segment the complete primitive in the knitted fabric image based on the size of the cyclic primitive.
[0090] The specific steps are as follows:
[0091] The steps of selecting the best feature map based on the size of the cyclic primitive and calculating the centroid coordinates of the cyclic primitive in the best feature map include:
[0092] The displacement set corresponding to each feature map is screened using the size of the cyclic primitive to obtain the best displacement set;
[0093] Specifically, the screening conditions are:
[0094] D l * ={d ij ∈D l :||d ij -d * ||<α}
[0095] Among them, D l * For the set of displacement vectors after screening, the threshold α is set according to the primitive size of the corresponding feature layer and can be adjusted.
[0096] Select and optimal displacement set D l * The feature layer corresponding to the displacement set with the largest number of displacement vectors is the best feature map; for example, in Example 1, there are three groups of feature maps in the multi-scale feature vectors obtained by the VGG19 network, and one group of feature maps can be selected. The best feature map is defined as l * .
[0097] For the best feature map l * The center-of-mass coordinates and the displacement vector in are calculated modulo the offset, and the offset is obtained by the offset calculation formula. The center-of-mass coordinates of the minimum offset are the center-of-mass coordinates of the cyclic primitive.
[0098] The specific formula is:
[0099]
[0100] In the formula, v represents a two-dimensional coordinate, whose coordinate value is (x, y); the function value M is a two-dimensional vector.
[0101] It can be seen that, unlike the traditional method of selecting multiple groups of feature layers for processing, this embodiment only selects a group of the most critical feature layers for processing, which not only significantly reduces the amount of calculation, but also does not affect the accuracy of the algorithm.
[0102] Furthermore, the step of segmenting the knitted fabric structure cycle primitives based on the centroid coordinates includes:
[0103] Based on the obtained centroid coordinates, a mathematical fitting method is used to obtain the optimal horizontal line and the optimal vertical line; preferably, the RANSAC (random sampling consensus) algorithm is used to fit these centroid coordinates.
[0104] The nodes of the grid are determined according to the optimal horizontal and vertical straight lines to form a two-dimensional grid.
[0105] Verification Example
[0106] Since the research on fabric weave loop primitive segmentation is still in its early stages and there is a lack of public experimental data and data sets for reference, this paper uses a self-made data set. This data set mainly contains fabric samples of knitted fabrics, with a total of 6,000 images, including knitted fabrics of 5 different weave types, and the image size of the model input is 512×512.
[0107] Since cyclic patterns do not follow a uniform pattern, many cyclic patterns even show some irregular repetitiveness. Human recognition of cyclic patterns is based on visual perception and is not absolutely accurate. Even in manually annotated datasets, it inevitably contains subjective judgment bias. In addition, considering that fabrics are inevitably stretched and distorted during production and use, fabric images are often not perfectly regular, but have certain deviations. In order to annotate the dataset, the method of manually drawing the grid is adopted, and the centroid coordinates and primitive sizes are recorded.
[0108] When defining the evaluation index of loop tissue primitive segmentation, the mean absolute error (MAE) is selected as the evaluation index. It is the sum of the absolute values of the difference between the target value and the predicted value, which measures the average of the sum of the errors of the predicted values in the data set, and the value range is from 0 to infinity, as shown in the following formula.
[0109]
[0110] Where: y irefers to the true value; Refers to the predicted value.
[0111] In the specific experiment, AlexNet network was used to extract 5 feature maps and MSS-VGG19 model was used to extract 3 feature maps for comparison. When AlexNet network was used, the detection time of each image was particularly long, up to more than 400 minutes, which could not be truly applied in practice; when MSS-VGG19 network was used, it only took about 2 minutes to test each image, greatly shortening the running time of the overall algorithm. The final segmentation result is as follows: Figure 6 shown.
[0112] As can be seen from the above figure, the segmentation of these fabric weave loop primitives is relatively accurate, but some fabrics have certain errors. The segmentation of the left part is relatively accurate, and the right part has a slight offset. This is because the fabric itself has some stretching phenomenon, and the algorithm calculates the weighted average scale, so this phenomenon occurs.
[0113] In order to test the performance of the algorithm, the loss values were calculated using knitted fabrics of different tissue categories, each category containing 200 pictures, and compared with the actual measurement results. The results are shown in Table 2 below.
[0114] Table 2 Loss of different tissue types
[0115] Organization Type MAE Edge Chain Organization 0.85 Economic and Peaceful Organization 0.63 Heavy satin weave 0.71 Reorganization 0.77 Rib warp plain weave 0.59
[0116] In terms of model running time, compared with the model before improvement, the average running time is shown in Table 3 below.
[0117] Table 3 Loss of different tissue types
[0118] Method Type Running time / min Model before improvement 231 Improved model 2.81
[0119] By analyzing the data in the above table, we can observe that in the model before the improvement, five feature maps were extracted and a series of complex calculations were performed, with a cumulative time of up to 231 minutes. This significant time consumption is mainly due to the large amount of time consumed in the two processes of finding the peak point and constructing the Hough voting space. In order to optimize this process, the number of feature maps to be processed was reduced, and only the best feature map was selected when segmenting the primitives, rather than multiple maps. This strategy significantly reduced the amount of calculation and effectively shortened the overall processing time. Through this streamlined and efficient method, the accuracy of the processing process is maintained and the computational efficiency is improved.
[0120] In order to evaluate the performance of the algorithm proposed in this paper, it is compared with other existing methods. Specifically, two different algorithms are compared: method 1 is a method based on the homogeneity value of the sum difference histogram (HCDH algorithm), and method 2 is a method for segmenting the printed pattern. The segmentation results of the experimental part are shown in Figure 7 and Figure 8 middle.
[0121] It can be clearly seen from the above figure that when these two algorithms are applied to the detection of cyclic primitives in knitted fabrics, the effect is not ideal. The reason for this is that the research objects of these algorithms are different from those of the present invention, so the results are not satisfactory. The HCDH algorithm is tested on wallpaper images provided by the PSU database. The cyclic patterns in the database are completely consistent in shape and have obvious characteristics, so the HCDH algorithm can achieve better segmentation effects. However, the structure of knitted fabrics is more complex, and the cyclic patterns cannot be completely consistent.
[0122] As for the second method, it is mainly aimed at printed fabrics, which is somewhat different from the knitted fabrics that the present invention is concerned with. The pattern of printed fabrics is usually fixed and compact, and is not easily deformed during use, so it is easier to be identified. In addition, the second method uses the AlexNet network and extracts five feature maps for peak point detection and construction of the Hough voting space. This process is time-consuming, and there is an overfitting phenomenon in the recognition accuracy. This results in the grid being too dense when processing the segmentation map of certain knitted fabrics, which in turn affects the loss value of the segmentation. Then, the two methods were tested for average loss values and compared with the method proposed in the present invention. The results are shown in Table 4 below.
[0123] Table 4 Comparative experimental results
[0124] Method Name Accuracy Method 1 55.2% Method 2 76.4% This method 88.9%
[0125] By analyzing the above table data, it can be clearly observed that in the task of primitive division of knitted fabrics, the performance of method 1 is not satisfactory, and although the effect of method 2 is considerable, the calculation time required is significantly longer. In contrast, the method proposed in the present invention not only achieves an accuracy rate of 88.9%, but also reduces the model calculation time, and the overall performance is excellent, showing its potential value in practical applications.
[0126] Example 2
[0127] This embodiment provides a knitted fabric tissue cycle primitive segmentation device based on deep learning, such as Fig. 9 As shown, including:
[0128] A feature extraction module is used to obtain a knitted fabric image and to perform multi-scale feature extraction on the knitted fabric image using a trained MSS-VGG19 model to obtain multiple feature maps;
[0129] The primitive size determination module is used to screen out the peak points in each extracted feature map, construct the Hough voting space according to the distance between the peak points, and perform voting in the Hough voting space to obtain the cyclic primitive size;
[0130] A primitive centroid coordinate acquisition module is used to select the best feature map based on the size of the cyclic primitive and calculate the centroid coordinates of the cyclic primitive in the best feature map;
[0131] The primitive segmentation module segments the knitted fabric structure loop primitives based on the centroid coordinates.
[0132] Specifically, the MSS-VGG19 model, the method for screening peak points, the method for obtaining the size of cyclic primitives, the method for obtaining the centroid coordinates, and the specific method for segmentation are all referred to Example 1 and will not be elaborated here.
[0133] Example 3
[0134] This embodiment provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method proposed in Embodiment 1 when executing the computer program.
[0135] Example 4
[0136] This embodiment provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the method proposed in Embodiment 1 are implemented.
[0137] Example 5
[0138] This embodiment provides a computer program product, including a computer program, which implements the steps of the method proposed in Embodiment 1 when executed by a processor.
[0139] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0140] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0141] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, ordinary technicians in the field should understand that the specific implementation methods of the present invention can still be modified or some technical features can be replaced by equivalents without departing from the spirit of the technical solution of the present invention, which should be included in the scope of the technical solution for protection of the present invention.
Claims
1. A method for segmenting knitted fabric tissue loop primitives based on deep learning, characterized in that: The following steps are involved: Acquire a knitted fabric image, use the trained MSS-VGG19 model to perform multi-scale feature extraction on the knitted fabric image, and obtain multiple feature maps; In each extracted feature map, the peak points are screened out, the Hough voting space is constructed according to the distance between the peak points, and voting is performed in the Hough voting space to obtain the size of the cyclic primitive; Filter out the best feature map based on the size of the cyclic primitive, and calculate the centroid coordinates of the cyclic primitive in the best feature map; The knitted fabric structure loop primitives are segmented based on the centroid coordinates.
2. The method for segmenting knitted fabric tissue cyclic primitives based on deep learning according to claim 1, characterized in that: The Hough voting space is constructed based on the distance between the peak points. The steps for voting in the Hough voting space to obtain the size of the cyclic primitive are: Define each set of peak points as p i , p j ∈P l , P l is the set of peak points of the lth feature map; i, j is the position of the peak points of this group in the lth feature map; According to d ij :|p i -p j |,i≠jCalculate the displacement vector d ij , construct the displacement set D l ={d ij }, where || is the absolute value of the vector; Take each bit of the displacement vector d as the displacement set ij is the mean, and the covariance matrix is Construct a two-dimensional normal distribution, where σ l The calculation formula is: σ l =(image.size(2) / l.size(1)) / 2 Where, image represents the knitted fabric image, image.size(2) represents the third dimension of the knitted fabric image, and l.size(1) represents the second dimension of the lth feature map; Calculate the probability density value V through the two-dimensional normal distribution function l,i,j : Where V l,i,j Represents the two-dimensional normal distribution probability density value of (i, j) in the lth feature map; Construct the Hough voting space V according to the probability density function: In the Hough voting space V, the horizontal maximum value and the vertical maximum value are selected as the cycle primitive size (d x ,d y ).
3. The method for segmenting knitted fabric tissue loop primitives based on deep learning according to claim 1, characterized in that: The steps of screening out peak points in each extracted feature map include: Resize the feature map to the original knitted fabric image size; Perform edge detection on the adjusted feature map, and smooth the image by Gaussian filtering and maximum filtering; The peak point detection method is used to obtain the peak point in the feature map.
4. The method for segmenting knitted fabric tissue cyclic primitives based on deep learning according to claim 2, characterized in that: The steps of selecting the best feature map based on the size of the cyclic primitive and calculating the centroid coordinates of the cyclic primitive in the best feature map include: The displacement set corresponding to each feature map is screened using the size of the cyclic primitive to obtain the best displacement set; Select the feature layer corresponding to the displacement set with the largest number of consistent displacement vectors in the optimal displacement set as the optimal feature map; The center-of-mass coordinates and displacement vector in the best feature map are modulo calculated, and then the offset is obtained through the offset calculation formula. The center-of-mass coordinates with the minimum offset are the center-of-mass coordinates of the cyclic primitive.
5. The method for segmenting knitted fabric tissue cyclic primitives based on deep learning according to claim 1, characterized in that: The steps of segmenting the knitted fabric weave loop primitives based on the centroid coordinates include: Based on the obtained centroid coordinates, the optimal horizontal and vertical lines are obtained using mathematical fitting methods; The nodes of the grid are determined according to the optimal horizontal and vertical straight lines to form a two-dimensional grid.
6. The method for segmenting knitted fabric tissue cyclic primitives based on deep learning according to claim 1, characterized in that: The MSS-VGG19 model includes 16 convolutional layers with a multi-branch structure, 1 spatial pyramid pooling layer and 3 fully connected layers. The multi-branch structure includes a main branch with a 3×3 convolution kernel, an auxiliary branch with a 1×1 convolution kernel and a branch containing only batch normalization operations; the fully connected layer is compressed using SVD matrix decomposition.
7. A knitted fabric structure cycle primitive segmentation device based on deep learning, characterized in that: include: A feature extraction module is used to obtain a knitted fabric image and to perform multi-scale feature extraction on the knitted fabric image using a trained MSS-VGG19 model to obtain multiple feature maps; The primitive size determination module is used to screen out the peak points in each extracted feature map, construct the Hough voting space according to the distance between the peak points, and perform voting in the Hough voting space to obtain the cyclic primitive size; A primitive centroid coordinate acquisition module is used to select the best feature map based on the size of the cyclic primitive and calculate the centroid coordinates of the cyclic primitive in the best feature map; The primitive segmentation module segments the knitted fabric structure loop primitives based on the centroid coordinates.
8. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.