A method for detecting the tension of coated yarn during sock forming production process
Through real-time video acquisition and image processing technology, combined with multi-dimensional feature extraction network, a tension change detection model is constructed, which solves the problem that the existing technology is difficult to realize dynamic tension change detection of multiple strands of coated yarns, and achieves high accuracy and non-contact tension detection.
Patent Information
- Application Number
- CN202411823109.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2044-12-12
AI Technical Summary
The existing coated yarn tension detection methods are difficult to detect dynamic tension change throughout the process of multi-strand coated yarn feeding, and traditional contact sensors have problems affecting the production process.
By shooting the multi-strand coated yarn feeding videos in the sock forming production process in real time, the video frame is extracted to obtain the coated yarn image collection, combined with the spatial feature extraction network, the timing feature extraction network and the changing parameter feature extraction network, a tension change detection model is constructed to realize the multi-dimensional feature extraction and fusion of the tension changes of coated yarn.
Dynamic tension change detection of the entire process of coated yarn feeding is realized, which significantly improves the accuracy of tension detection and avoids physical interference to the production process.
Smart Images

Figure CN119295457B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of image analysis, and in particular to a method for detecting the tension of a coated yarn in a sock forming production process. Background Art
[0002] Covered yarn is an important raw material in the sock forming production process. During the sock forming production process, the tension stability of the covered yarn directly affects the appearance quality and comfort of the socks. In the production process, there are usually multiple strands of covered yarn being fed at the same time. The tension of each strand of covered yarn will change when it passes through the yarn guide ring, yarn clamping device and other components to reach the weaving area. Therefore, it is of great significance to perform real-time detection of the tension change during the covered yarn feeding process.
[0003] At present, the detection of the tension of the coated yarn mainly adopts the detection method based on strain sensors, the detection method based on piezoelectric sensors and the detection method based on machine vision. The detection method based on strain sensors converts the tension of the coated yarn into an electrical signal for detection by installing the strain sensor on the yarn guide arm or the yarn clamping device. The detection method based on piezoelectric sensors uses the piezoelectric effect of piezoelectric crystals to detect tension. However, the detection methods based on strain sensors and piezoelectric sensors require direct contact with the coated yarn, which is easy to affect the production process, and the temperature drift of the piezoelectric sensor will affect the stability of the detection. The detection method based on machine vision uses an image acquisition device to shoot the coated yarn, and uses image processing technology to perform tension analysis, thereby realizing non-contact detection. However, the existing tension detection method based on machine vision mainly focuses on the static characteristics of a single strand of coated yarn, and cannot realize the dynamic tension change detection of the whole process of yarn feeding of multiple strands of coated yarn, and further improve the accuracy of tension detection.
[0004] Therefore, a method for detecting the tension of covered yarn in the sock forming production process is proposed. Summary of the invention
[0005] The object of the present invention is to provide a method for detecting the tension of a covered yarn in a sock forming production process. First, a video of the yarn feeding process of multiple covered yarns in the sock forming production process is shot, and video frames are extracted at time intervals to obtain a set of covered yarn images; then, each covered yarn area image is extracted according to the covered yarn image at each time point; the covered yarn area images of the same covered yarn at two adjacent time points are extracted to obtain a first covered yarn area image and a second covered yarn area image; a change parameter set is extracted according to the first covered yarn area image and the second covered yarn area image; the first covered yarn area image, the second covered yarn area image and the change parameter set are input into a tension change model, and multi-dimensional feature extraction, fusion and analysis are performed to obtain a tension change value.
[0006] To achieve the above object, the present invention provides the following technical solutions:
[0007] A method for detecting the tension of a covered yarn during a sock forming production process, comprising:
[0008] Real-time filming of the socks forming process Video of the yarn feeding process of the ply covered yarn, at time intervals Extracting video frames to obtain a set of coated yarn images;
[0009] The coated yarn image is extracted according to each time point A covered yarn area image; each of the covered yarn area images contains a strand of covered yarn;
[0010] Extracting the covered yarn region images of the same covered yarn at two adjacent time points to obtain a first covered yarn region image and a second covered yarn region image;
[0011] Extracting a set of variation parameters according to the first covered yarn area image and the second covered yarn area image; the set of variation parameters includes a motion variation parameter vector and a structure variation parameter vector;
[0012] A tension change detection model is constructed, and the first coated yarn area image, the second coated yarn area image and the change parameter set are input into the model to obtain a tension change value; the tension change detection model includes a spatial feature extraction network, a temporal feature extraction network, a change parameter feature extraction network and a fusion output network; the spatial feature extraction network extracts a hierarchical feature set based on the first coated yarn area image and the second coated yarn area image; the temporal feature extraction network obtains a temporal aggregation feature based on the hierarchical feature set; the change parameter feature extraction network obtains an enhanced change feature based on the change parameter set; the fusion output network outputs the tension change value based on the hierarchical feature set, the temporal aggregation feature and the enhanced change feature.
[0013] Preferably, the time interval The settings meet the conditions ;in, Indicates the yarn feeding speed during the sock forming production process; Indicates the distance from the yarn feeding starting point to the weaving area; represents the minimum time interval threshold coefficient; Indicates the maximum time interval threshold coefficient.
[0014] Preferably, extract The covered yarn area image comprises:
[0015] S1. Preprocessing the coated yarn image to obtain a preprocessed coated yarn image; the preprocessing includes: performing adaptive illumination compensation on the coated yarn image, using adaptive histogram equalization to enhance local contrast, and applying anisotropic diffusion filtering to eliminate noise;
[0016] S2. Calculate the image gradient amplitude of the pre-processed coated yarn image using the Sobel operator to obtain an edge feature map;
[0017] S3. Detecting a straight line according to the edge feature map, and selecting a marking point on the detected straight line;
[0018] S4. Using the watershed algorithm, the image is segmented using the marked points as seed points to obtain an initial segmentation area;
[0019] S5. Obtain the number of the initial segmented areas Perform verification and obtain The coated yarn area image; the verification processing step comprises: S51. If , perform region merging on the initial segmented regions until ; S52. If , perform region segmentation on the initial segmented region until ; S53. If , generating a mask for each of the initial segmented regions, extracting the pre-processed covered yarn image according to the mask An image of the covered yarn area.
[0020] Preferably, the specific steps of performing region merging on the initial segmented regions include:
[0021] S511. Constructing a region adjacency graph based on the initial segmented regions;
[0022] S512. Calculate the merged scores of adjacent initial segmented regions;
[0023] S513. Merging the adjacent initially segmented regions with the highest merging scores;
[0024] S514. Update the initial segmentation area set and the number of the initial segmentation areas , return to step S521;
[0025] The specific steps of performing region segmentation on the initial segmented region include:
[0026] S521. Calculate the splitting index of each of the initial segmented regions;
[0027] S522. Select the initial segmentation area with the largest split index as the candidate area, and set a counter ;
[0028] S523. Segment the candidate region using a gradient suppression threshold to obtain a sub-region set;
[0029] S524. Count the number of sub-regions that meet the constraints ,if , select the sub-region with the largest area among the sub-regions that meet the constraints as the new initial segmentation region and update the number of the initial segmentation regions , return to step S531; if and , adjust the gradient suppression threshold, and update the counter , return to step S533; if and , set the splitting index corresponding to the candidate region to 0, and return to step S532; represents the adjustment times threshold; the constraints include area constraint, aspect ratio constraint and linearity constraint.
[0030] Preferably, extracting a set of variation parameters according to the first covered yarn area image and the second covered yarn area image comprises:
[0031] Calculate the motion vector of the pixel point according to the first covered yarn area image and the second covered yarn area image to obtain an initial displacement field;
[0032] According to the initial displacement field, a parameter feature pyramid is constructed to perform multi-scale decomposition and fusion to obtain a multi-scale fusion motion feature set;
[0033] Extracting average displacement velocity, strain rate and average rotation angle according to the multi-scale fusion motion feature set to obtain the motion change parameter vector;
[0034] Extract the covered yarn skeleton line according to the first covered yarn area image and the second covered yarn area image respectively, and sample the covered yarn skeleton line at equal intervals along the covered yarn skeleton line. points;
[0035] Calculate the section width, minimum curvature, and maximum curvature at each sampling point;
[0036] The cross-sectional width change rate, thickness uniformity change rate, shape change rate, Gaussian curvature change rate and average curvature change rate are calculated according to the cross-sectional width, the minimum curvature and the maximum curvature at each sampling point to obtain a structural change parameter vector.
[0037] Preferably, the spatial feature extraction network extracts the hierarchical feature set including:
[0038] Construct an image feature pyramid to perform multi-scale decomposition and fusion on the first coated yarn area image and the second coated yarn area image to obtain an initial hierarchical feature set ;in, It indicates that the first coated yarn region image passes through the image feature pyramid The output of the layer; It indicates that the second coated yarn region image passes through the image feature pyramid The output of the layer; , Represents the number of layers of the image feature pyramid;
[0039] Calculating a feature difference set between the first covered yarn region image and the second covered yarn region image according to the initial level feature set;
[0040] Calculate an update weight set according to the feature difference set, and update the initial level feature set according to the update weight set to obtain the level feature set ;in, represents the first coated yarn area image obtained according to the first coated yarn area image Level features; Indicates that the first level features.
[0041] Preferably, the temporal feature extraction network calculates the temporal aggregation feature according to the hierarchical feature set, including:
[0042] Extract hierarchical features from the hierarchical feature set and ,right Channel compression and position encoding are performed to obtain the first transformation feature map. Channel compression and position encoding are performed to obtain a second transformation feature map; wherein, represents the first coated yarn area image obtained according to the first coated yarn area image Level features; represents the first Level features;
[0043] Expanding the first transformed feature map and the second transformed feature map respectively to obtain a first feature vector and a second feature vector;
[0044] Calculate an association matrix based on the first eigenvector and the second eigenvector;
[0045] Calculate row attention weights and column attention weights according to the association matrix;
[0046] The first feature vector and the second feature vector are respectively feature weighted according to the row attention weight and the column attention weight, and are concatenated to obtain a temporal aggregation feature.
[0047] Preferably, the variation parameter feature extraction network obtains enhanced variation features according to the variation parameter set, including:
[0048] The motion change parameter vector and the structure change parameter vector are concatenated and mapped to dimensional space, and obtain the characteristic vector of the changing parameters;
[0049] A self-attention calculation is performed according to the change parameter feature vector to obtain the enhanced change feature.
[0050] Preferably, the fusion output network includes:
[0051] Extract hierarchical features from the hierarchical feature set and , respectively and Perform global pooling and concatenate in the channel number dimension to obtain spatial aggregation features;
[0052] Performing dimension transformation on the spatial aggregation feature, and weightedly fusing the dimensionally transformed spatial aggregation feature, the temporal aggregation feature, and the enhanced change feature through an attention mechanism to obtain a fused feature;
[0053] Outputting a tension change value according to the fused feature.
[0054] Preferably, the loss function of the tension change detection model includes mean square error loss and smoothing loss, and the calculation formula of the loss function is:
[0055] ;
[0056] in, represents the loss function; represents the mean square error loss; represents the smoothing loss; represents the weight coefficient of the smoothing loss; Indicates The tension change value obtained by inputting a group of samples into the tension change detection model; Indicates The actual tension change value corresponding to the group samples; Indicates the sample size.
[0057] Compared with the prior art, the present invention has the following beneficial effects:
[0058] 1. A tension change detection model integrating spatial features, temporal features and variable parameter features is proposed. By shooting videos in real time and extracting images of the coated yarn area, the system can simultaneously capture the spatial structural features and temporal change features of the coated yarn; the spatial feature extraction network captures static structural information, the temporal feature extraction network captures dynamic change information, and the variable parameter feature extraction network extracts physical change features; the multi-dimensional feature extraction method ensures a comprehensive perception of the tension change of the coated yarn; by integrating multi-dimensional features through the fusion output network, the tension change detection of the coated yarn in the whole process of yarn feeding can be realized, which significantly improves the accuracy of tension detection.
[0059] 2. The verification and processing mechanism of the regional segmentation method ensures that an accurate image of the coated yarn region is obtained in the end through bidirectional adjustment of region merging and segmentation. In the merging process, accurate regional fusion is achieved by constructing a regional adjacency graph and calculating the merging score. In the segmentation process, gradient suppression thresholds and multiple constraints are used to ensure the accuracy of segmentation. This provides high-quality input data for subsequent feature extraction, ensuring the accuracy of tension change detection in the case of multiple strands of coated yarn.
[0060] 3. The motion change parameters and structural change parameters are comprehensively considered to extract the change parameters. In terms of motion change parameters, the average displacement velocity, strain rate and average rotation angle are extracted; in terms of structural change parameters, the cross-sectional width change rate, thickness uniformity change rate, shape change rate, Gaussian curvature change rate and average curvature change rate are calculated; the multi-dimensional change parameter extraction comprehensively describes the changes in the physical properties of the coated yarn, provides rich feature support for tension detection, and can improve the accuracy of tension change detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] Figure 1 A schematic flow chart of a method for detecting tension of a coated yarn in a sock forming production process provided by an embodiment of the present invention;
[0062] Figure 2 A schematic diagram of the tension change detection model structure provided by an embodiment of the present invention;
[0063] Figure 3 A schematic diagram of the process of extracting the image of the coated yarn area provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0064] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0065] Embodiment 1
[0066] A knitting socks factory uses a horizontal knitting machine on the production line and uses three-ply covered yarn for production. During the production process, the unstable yarn feeding tension will cause quality problems such as yarn breakage and stitch skipping. To solve this problem, the factory implements a method for detecting the tension of the covered yarn in the sock forming production process of the present invention, such as Figure 1 As shown, including:
[0067] Real-time filming of the socks forming process Video of the yarn feeding process of the ply covered yarn, at time intervals Extracting video frames to obtain a set of coated yarn images;
[0068] The coated yarn image is extracted according to each time point A covered yarn area image; each of the covered yarn area images contains a strand of covered yarn;
[0069] Extracting the covered yarn region images of the same covered yarn at two adjacent time points to obtain a first covered yarn region image and a second covered yarn region image;
[0070] Extracting a set of variation parameters according to the first covered yarn area image and the second covered yarn area image; the set of variation parameters includes a motion variation parameter vector and a structure variation parameter vector;
[0071] Construct a tension change detection model, input the first covered yarn area image, the second covered yarn area image and the change parameter set into the model, and obtain the tension change value; Figure 2 As shown, the tension change detection model includes a spatial feature extraction network, a temporal feature extraction network, a change parameter feature extraction network and a fusion output network; the spatial feature extraction network extracts a hierarchical feature set according to the first coated yarn area image and the second coated yarn area image; the temporal feature extraction network obtains a temporal aggregation feature according to the hierarchical feature set; the change parameter feature extraction network obtains an enhanced change feature according to the change parameter set; the fusion output network outputs the tension change value according to the hierarchical feature set, the temporal aggregation feature and the enhanced change feature.
[0072] Furthermore, the time interval The settings meet the conditions ;in, Indicates the yarn feeding speed during the sock forming production process; Indicates the distance from the yarn feeding starting point to the weaving area; represents the minimum time interval threshold coefficient; Indicates the maximum time interval threshold coefficient.
[0073] In the embodiment of the present application, the basic parameters are shown in Table 1, the yarn feeding speed is 0.2m / s, the distance from the yarn feeding starting point to the weaving area is 0.5m, , , and obtain a coated yarn image every 0.5s.
[0074] Table 1 Basic parameters
[0075]
[0076] By setting a reasonable time interval threshold, it is ensured that the images at adjacent time points can reflect the changing characteristics of the coated yarn without causing information loss due to too long an interval, thereby improving the timeliness and accuracy of the detection.
[0077] Furthermore, if Figure 3 As shown, extract The covered yarn area image comprises:
[0078] S1. Preprocessing the coated yarn image to obtain a preprocessed coated yarn image; the preprocessing includes: performing adaptive illumination compensation on the coated yarn image, using adaptive histogram equalization to enhance local contrast, and applying anisotropic diffusion filtering to eliminate noise;
[0079] S2. Calculate the image gradient amplitude of the pre-processed coated yarn image using the Sobel operator to obtain an edge feature map;
[0080] S3. Detecting a straight line according to the edge feature map, and selecting a marking point on the detected straight line;
[0081] S4. Using the watershed algorithm, the image is segmented using the marked points as seed points to obtain an initial segmentation area;
[0082] S5. Obtain the number of the initial segmented areas Perform verification and obtain The coated yarn area image; the verification processing step comprises: S51. If , perform region merging on the initial segmented regions until ; S52. If , perform region segmentation on the initial segmented region until ; S53. If , generating a mask for each of the initial segmented regions, extracting the pre-processed covered yarn image according to the mask An image of the covered yarn area.
[0083] Further, the first The formula for the image of the covered yarn area is:
[0084] ;
[0085] in, Indicates an image of the covered yarn area; representing the pre-treated covered yarn image; Indicates a mask of the initial segmented region, .
[0086] The image preprocessing process ensures the image quality. The segmentation method based on the Sobel operator and the watershed algorithm combined with the verification processing mechanism can accurately extract the image of the coated yarn area, ensure the reliability of the segmentation results, and provide high-quality input data for subsequent feature extraction.
[0087] Furthermore, the specific steps of performing region merging on the initial segmented regions include:
[0088] S511. Constructing a region adjacency graph based on the initial segmented regions;
[0089] S512. Calculate the merged scores of adjacent initial segmented regions;
[0090] S513. Merging the adjacent initially segmented regions with the highest merging scores;
[0091] S514. Update the initial segmentation area set and the number of the initial segmentation areas , return to step S521.
[0092] Furthermore, the specific steps of performing region segmentation on the initial segmented region include:
[0093] S521. Calculate the splitting index of each of the initial segmented regions;
[0094] S522. Select the initial segmentation area with the largest split index as the candidate area, and set a counter ;
[0095] S523. Segment the candidate region using a gradient suppression threshold to obtain a sub-region set;
[0096] S524. Count the number of sub-regions that meet the constraints ,if , select the sub-region with the largest area among the sub-regions that meet the constraints as the new initial segmentation region and update the number of the initial segmentation regions , return to step S531; if and , adjust the gradient suppression threshold, and update the counter , return to step S533; if and , setting the splitting index of the initial segmented region corresponding to the candidate region to 0, and returning to step S532; represents the adjustment times threshold; the constraints include area constraint, aspect ratio constraint and linearity constraint.
[0097] In special cases, when , If the splitting indexes of all the initial segmented regions are 0, it is necessary to return to step S1 and adjust the parameters to obtain the initial segmented regions again.
[0098] Furthermore, the combined score calculation formula is:
[0099] ;
[0100] in, Represents the adjacent initial segmentation area and The combined score of and represents the weight coefficient; and Respectively represent the initial segmentation area and area; and Respectively represent the initial segmentation area and linearity.
[0101] Furthermore, the split index calculation formula is:
[0102] ;
[0103] in, Indicates The initial segmentation area The combined score of Represents the initial segmentation area area; Represents the initial segmentation area Linearity: The linearity of an image area refers to the degree of straightness of the edges within the area.
[0104] Accurate regional fusion is achieved through the bidirectional adjustment mechanism of region merging and region segmentation, combined with the calculation of region adjacency graph and merging score. The gradient suppression threshold and multiple constraints are used in the segmentation process to ensure the accuracy and rationality of the segmentation results. It can adapt to the changes in image features of coated yarn under different production environments and improve segmentation accuracy.
[0105] Further, extracting a set of variation parameters according to the first covered yarn area image and the second covered yarn area image includes:
[0106] The optical flow algorithm is used to calculate the motion vector of the pixel point according to the first coated yarn area image and the second coated yarn area image to obtain the initial displacement field ; Represents pixel exist Directional displacement; Represents pixel exist Directional displacement;
[0107] According to the initial displacement field, a parameter feature pyramid is constructed to perform multi-scale decomposition and fusion to obtain a multi-scale fusion motion feature set. ;in, represents the multi-scale fusion displacement field, represents the multi-scale fusion strain field, represents the multi-scale fused rotation field;
[0108] Extracting the average displacement velocity according to the multi-scale fusion motion feature set , strain rate and the average rotation angle , get the motion change parameter vector ;
[0109] Extract the covered yarn skeleton line according to the first covered yarn area image and the second covered yarn area image respectively, and sample the covered yarn skeleton line at equal intervals along the covered yarn skeleton line. points;
[0110] Calculate the section width, minimum curvature, and maximum curvature at each sampling point;
[0111] The cross-sectional width change rate is calculated according to the cross-sectional width, the minimum curvature and the maximum curvature at each sampling point. , Coarseness and fineness uniformity change rate , shape change rate , Gaussian curvature change rate and the mean curvature rate of change , and obtain the structural change parameter vector .
[0112] Furthermore, calculating the cross-section width, minimum curvature and maximum curvature at each sampling point includes:
[0113] Calculate the tangent vector and normal vector of the covered yarn skeleton line at each sampling point, search along the positive and negative directions of the normal vector from the sampling point, and obtain the left boundary point and right boundary point ;
[0114] According to the left boundary point and right boundary point Calculate the section width at the current sampling point;
[0115] Taking the sampling point as the origin, the tangent vector is Axis direction, normal vector is Axis direction, secondly, fitting the local surface through the secondary surface;
[0116] According to the local surface, the Hessian matrix is calculated and the characteristic equation is solved to obtain the minimum curvature and the maximum curvature at the sampling point; the Hessian matrix is Each element in the matrix is the second-order partial derivative of the local surface equation.
[0117] Through the multi-scale decomposition of optical flow algorithm and parameter feature pyramid, the accurate extraction of motion features is achieved; combined with the extraction of coated yarn skeleton line and the setting of equally spaced sampling points, the changes in physical properties of the coated yarn are comprehensively characterized by calculating structural parameters such as cross-sectional width and curvature; it not only provides rich feature expressions, but also improves the accuracy of curvature calculation through local surface fitting, providing reliable feature support for tension change detection.
[0118] Furthermore, the spatial feature extraction network extracts the hierarchical feature set including:
[0119] Construct an image feature pyramid to perform multi-scale decomposition and fusion on the first coated yarn area image and the second coated yarn area image to obtain an initial hierarchical feature set ;in, It indicates that the first coated yarn region image passes through the image feature pyramid The output of the layer; It indicates that the second coated yarn region image passes through the image feature pyramid The output of the layer; , Represents the number of layers of the image feature pyramid;
[0120] According to the initial level feature set, a feature difference set between the first covered yarn area image and the second covered yarn area image is calculated. , ;
[0121] Generate an update weight set based on the feature difference set , ;in, Indicates Update weights, represents the activation function, Represents the convolution operation;
[0122] The initial hierarchical feature set is updated according to the update weight set to obtain the hierarchical feature set ;in, represents the first coated yarn area image obtained according to the first coated yarn area image Level features; Indicates that the first Level features, , .
[0123] By constructing an image feature pyramid for multi-scale decomposition and fusion, combining feature difference sets and updating weight mechanisms, adaptive integration of features at different scales is achieved; it can effectively capture the spatial characteristics of the coated yarn at different scales, improve the comprehensiveness and accuracy of feature extraction, and enhance the model's perception of changes at different scales.
[0124] Furthermore, the temporal feature extraction network calculates the temporal aggregation feature according to the hierarchical feature set, including:
[0125] Extract hierarchical features from the hierarchical feature set and ,right Channel compression and position encoding are performed to obtain the first transformation feature map. Channel compression and position encoding are performed to obtain a second transformation feature map; wherein, represents the first coated yarn area image obtained according to the first coated yarn area image Level features; represents the first Level features;
[0126] Expand the first transformed feature map and the second transformed feature map respectively to obtain a first feature vector and the second eigenvector ;
[0127] An association matrix is calculated based on the first eigenvector and the second eigenvector. The calculation formula is:
[0128] ;
[0129] in, represents the dimension of each element in the feature vector, where and represents the learnable parameter matrix;
[0130] The row attention weight and column attention weight are calculated according to the association matrix, and the calculation formula is as follows:
[0131] ;
[0132] in, represents the row attention weight; represents the normalization function; Represents the association matrix Maximum value for each row; represents the row attention weight; It means taking the maximum value of each column of the correlation matrix;
[0133] The first feature vector and the second feature vector are weighted according to the row attention weight and the column attention weight, and are concatenated to obtain a temporal aggregation feature. The calculation formula is as follows:
[0134] ;
[0135] in, represents the time series aggregation feature; Represents a concatenation operation.
[0136] In the embodiment of the present application, a 4-layer feature pyramid is used to construct the image feature pyramid. ; Select the hierarchical features of the third layer and Calculate time series aggregation features, .
[0137] Through the feature transformation of channel compression and position encoding, as well as the bidirectional feature weighting mechanism of row and column attention weights, efficient extraction of temporal features is achieved; it can not only accurately capture the feature changes between consecutive time frames, but also highlight the key temporal information through the attention mechanism, thereby improving the accuracy of temporal feature extraction and the effectiveness of feature expression.
[0138] Furthermore, the variation parameter feature extraction network obtains enhanced variation features according to the variation parameter set, including:
[0139] The motion change parameter vector and the structure change parameter vector are concatenated and mapped to dimensional space, and obtain the characteristic vector of the changing parameters;
[0140] A self-attention calculation is performed according to the change parameter feature vector to obtain the enhanced change feature.
[0141] Through high-dimensional mapping of changing parameters and self-attention calculation, the expressiveness of changing features is enhanced; deep feature extraction of changing parameters is achieved, the discriminability of features is improved, and a more discriminative feature representation is provided for subsequent tension detection.
[0142] Furthermore, the fusion output network includes:
[0143] Extract hierarchical features from the hierarchical feature set and , respectively and Perform global pooling and concatenate in the channel number dimension to obtain spatial aggregation features. The calculation formula is as follows:
[0144] ;
[0145] in, represents the spatial aggregation feature; Represents a global pooling operation;
[0146] The spatial aggregation feature is transformed in dimension, and the spatial aggregation feature, the temporal aggregation feature and the enhanced change feature after the dimension transformation are weightedly fused through the attention mechanism to obtain the fusion feature. The calculation formula is as follows:
[0147] ;
[0148] in, represents the fusion feature; , and represents the learnable weight matrix; represents the time series aggregation feature; Indicates the enhanced change characteristics;
[0149] Outputting a tension change value according to the fused feature.
[0150] Through global pooling operations and channel dimension splicing, efficient spatial aggregation features are obtained; combined with the attention mechanism, the adaptive fusion of spatial aggregation features, temporal aggregation features and enhanced change features is realized, and the feature fusion process is optimized through the learnable weight matrix, which improves the accuracy and effectiveness of the final feature expression.
[0151] Furthermore, the loss function of the tension change detection model includes mean square error loss and smoothing loss, and the calculation formula of the loss function is:
[0152] ;
[0153] in, represents the loss function; represents the mean square error loss; represents the smoothing loss; represents the weight coefficient of the smoothing loss; Indicates The tension change value obtained by inputting a group of samples into the tension change detection model; Indicates The actual tension change value corresponding to the group samples; Indicates the sample size.
[0154] By designing a loss function that combines mean square error loss and smoothing loss, we can ensure both the accuracy of the detection results and the smoothness of the prediction results. The loss function enhances the stability of model training, improves the continuity of prediction results, and can improve the overall performance of the model.
[0155] In the embodiment of the present application, the three covered yarns are yarn No. 1, yarn No. 2 and yarn No. 3 respectively, and the tension change detection results obtained by the tension change detection model are shown in Table 2.
[0156] Table 2 Tension change detection results
[0157]
[0158] The present invention realizes continuous monitoring of the covered yarn feeding process through real-time video acquisition and image processing technology. Compared with the traditional contact sensor detection method, it avoids physical damage to the covered yarn and reduces interference with the production process. A model architecture combining a spatial feature extraction network, a temporal feature extraction network and a change parameter feature extraction network, plus a fusion output network, is adopted to realize all-round perception of the static structural characteristics, dynamic change characteristics and physical change characteristics of the covered yarn, thereby ensuring the accuracy of the detection of the covered yarn tension change. The loss function including the mean square error loss and the smoothing loss not only ensures the detection accuracy, but also maintains the continuity of the prediction result. The present invention realizes real-time, accurate and non-contact detection of the covered yarn tension change, thereby providing reliable technical support for quality control in the socks production process.
[0159] Embodiment 2
[0160] In the first embodiment, the detection of the tension change of the covering yarn is realized. In the embodiment of the present application, a method for detecting the tension of the covering yarn in the sock forming production process proposed by the present invention is described again. The specific process includes:
[0161] Real-time filming of the socks forming process Video of the yarn feeding process of the ply covered yarn, at time intervals Extracting video frames to obtain a set of coated yarn images;
[0162] The coated yarn image is extracted according to each time point A covered yarn area image; each of the covered yarn area images contains a strand of covered yarn;
[0163] Extracting the covered yarn region images of the same covered yarn at two adjacent time points to obtain a first covered yarn region image and a second covered yarn region image;
[0164] Extracting a set of variation parameters according to the first covered yarn area image and the second covered yarn area image; the set of variation parameters includes a motion variation parameter vector and a structure variation parameter vector;
[0165] A tension change detection model is constructed, and the first coated yarn area image, the second coated yarn area image and the change parameter set are input into the model to obtain a tension change value; the tension change detection model includes a spatial feature extraction network, a temporal feature extraction network, a change parameter feature extraction network and a fusion output network; the spatial feature extraction network extracts a hierarchical feature set based on the first coated yarn area image and the second coated yarn area image; the temporal feature extraction network obtains a temporal aggregation feature based on the hierarchical feature set; the change parameter feature extraction network obtains an enhanced change feature based on the change parameter set; the fusion output network outputs the tension change value based on the hierarchical feature set, the temporal aggregation feature and the enhanced change feature.
[0166] Furthermore, the time interval The settings meet the conditions ;in, Indicates the yarn feeding speed during the sock forming production process; Indicates the distance from the yarn feeding starting point to the weaving area; represents the minimum time interval threshold coefficient; Indicates the maximum time interval threshold coefficient.
[0167] Furthermore, extract The covered yarn area image comprises:
[0168] S1. Preprocessing the coated yarn image to obtain a preprocessed coated yarn image; the preprocessing includes: performing adaptive illumination compensation on the coated yarn image, using adaptive histogram equalization to enhance local contrast, and applying anisotropic diffusion filtering to eliminate noise;
[0169] S2. Calculate the image gradient amplitude of the pre-processed coated yarn image using the Sobel operator to obtain an edge feature map;
[0170] S3. Detecting a straight line according to the edge feature map, and selecting a marking point on the detected straight line;
[0171] S4. Using the watershed algorithm, the image is segmented using the marked points as seed points to obtain an initial segmentation area;
[0172] S5. Obtain the number of the initial segmented areas Perform verification and obtain The coated yarn area image; the verification processing step comprises: S51. If , perform region merging on the initial segmented regions until ; S52. If , perform region segmentation on the initial segmented region until ; S53. If , generating a mask for each of the initial segmented regions, extracting the pre-processed covered yarn image according to the mask An image of the covered yarn area.
[0173] Furthermore, the specific steps of performing region merging on the initial segmented regions include:
[0174] S511. Constructing a region adjacency graph based on the initial segmented regions;
[0175] S512. Calculate the merged scores of adjacent initial segmented regions;
[0176] S513. Merging the adjacent initially segmented regions with the highest merging scores;
[0177] S514. Update the initial segmentation area set and the number of the initial segmentation areas , return to step S521;
[0178] Furthermore, the specific steps of performing region segmentation on the initial segmented region include:
[0179] S521. Calculate the splitting index of each of the initial segmented regions;
[0180] S522. Select the initial segmentation area with the largest split index as the candidate area, and set a counter ;
[0181] S523. Segment the candidate region using a gradient suppression threshold to obtain a sub-region set;
[0182] S524. Count the number of sub-regions that meet the constraints ,if , select the sub-region with the largest area among the sub-regions that meet the constraints as the new initial segmentation region and update the number of the initial segmentation regions , return to step S531; if and , adjust the gradient suppression threshold, and update the counter , return to step S533; if and , set the splitting index corresponding to the candidate region to 0, and return to step S532; represents the adjustment times threshold; the constraints include area constraint, aspect ratio constraint and linearity constraint.
[0183] Further, extracting a set of variation parameters according to the first covered yarn area image and the second covered yarn area image includes:
[0184] Calculate the motion vector of the pixel point according to the first covered yarn area image and the second covered yarn area image to obtain an initial displacement field;
[0185] According to the initial displacement field, a parameter feature pyramid is constructed to perform multi-scale decomposition and fusion to obtain a multi-scale fusion motion feature set;
[0186] Extracting average displacement velocity, strain rate and average rotation angle according to the multi-scale fusion motion feature set to obtain the motion change parameter vector;
[0187] Extract the covered yarn skeleton line according to the first covered yarn area image and the second covered yarn area image respectively, and sample the covered yarn skeleton line at equal intervals along the covered yarn skeleton line. points;
[0188] Calculate the section width, minimum curvature, and maximum curvature at each sampling point;
[0189] The cross-sectional width change rate, thickness uniformity change rate, shape change rate, Gaussian curvature change rate and average curvature change rate are calculated according to the cross-sectional width, the minimum curvature and the maximum curvature at each sampling point to obtain a structural change parameter vector.
[0190] Furthermore, the spatial feature extraction network extracts the hierarchical feature set including:
[0191] Construct an image feature pyramid to perform multi-scale decomposition and fusion on the first coated yarn area image and the second coated yarn area image to obtain an initial hierarchical feature set ;in, It indicates that the first coated yarn region image passes through the image feature pyramid The output of the layer; It indicates that the second coated yarn region image passes through the image feature pyramid The output of the layer; , Represents the number of layers of the image feature pyramid;
[0192] Calculating a feature difference set between the first covered yarn region image and the second covered yarn region image according to the initial level feature set;
[0193] Calculate an update weight set according to the feature difference set, and update the initial level feature set according to the update weight set to obtain the level feature set ;in, represents the first coated yarn area image obtained according to the first coated yarn area image Level features; Indicates that the first level features.
[0194] Furthermore, the temporal feature extraction network calculates the temporal aggregation feature according to the hierarchical feature set, including:
[0195] Extract hierarchical features from the hierarchical feature set and ,right Channel compression and position encoding are performed to obtain the first transformation feature map. Channel compression and position encoding are performed to obtain a second transformation feature map; wherein, represents the first coated yarn area image obtained according to the first coated yarn area image Level features; represents the first Level features;
[0196] Expanding the first transformed feature map and the second transformed feature map respectively to obtain a first feature vector and a second feature vector;
[0197] Calculate an association matrix based on the first eigenvector and the second eigenvector;
[0198] Calculate row attention weights and column attention weights according to the association matrix;
[0199] The first feature vector and the second feature vector are respectively feature weighted according to the row attention weight and the column attention weight, and are concatenated to obtain a temporal aggregation feature.
[0200] Furthermore, it is characterized in that the variation parameter feature extraction network obtains enhanced variation features according to the variation parameter set, including:
[0201] The motion change parameter vector and the structure change parameter vector are concatenated and mapped to dimensional space, and obtain the characteristic vector of the changing parameters;
[0202] A self-attention calculation is performed according to the change parameter feature vector to obtain the enhanced change feature.
[0203] Furthermore, it is characterized in that the fusion output network includes:
[0204] Extract hierarchical features from the hierarchical feature set and , respectively and Perform global pooling and concatenate in the channel number dimension to obtain spatial aggregation features;
[0205] Performing dimension transformation on the spatial aggregation feature, and weightedly fusing the dimensionally transformed spatial aggregation feature, the temporal aggregation feature, and the enhanced change feature through an attention mechanism to obtain a fused feature;
[0206] Outputting a tension change value according to the fused feature.
[0207] Table 3 gives the comparison of the detection performance of the tension change detection model under different working conditions.
[0208] Table 3 Tension change detection performance under different working conditions
[0209]
[0210] The standard working condition refers to a yarn feeding speed of 0.3 m / s, the low-speed working condition refers to a yarn feeding speed of 0.1 m / s, and the high-speed working condition refers to a yarn feeding speed of 0.5 m / s. It can be seen from Table 3 that the present invention can maintain a high tension change detection accuracy under different working conditions.
[0211] Furthermore, the loss function of the tension change detection model includes mean square error loss and smoothing loss, and the calculation formula of the loss function is:
[0212] ;
[0213] in, represents the loss function; represents the mean square error loss; represents the smoothing loss; represents the weight coefficient of the smoothing loss; Indicates The tension change value obtained by inputting a group of samples into the tension change detection model; Indicates The actual tension change value corresponding to the group samples; Indicates the sample size.
[0214] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A method for detecting the tension of covered yarn in the sock forming production process, characterized in that: include: Real-time filming of the socks forming process Video of the yarn feeding process of the ply covered yarn, at time intervals Extracting video frames to obtain a set of coated yarn images; The coated yarn image is extracted according to each time point An image of the covered yarn area; There is one strand of covering yarn in each of the covering yarn region images; Extracting the covered yarn region images of the same covered yarn at two adjacent time points to obtain a first covered yarn region image and a second covered yarn region image; Extracting a set of variation parameters according to the first covered yarn area image and the second covered yarn area image; the set of variation parameters includes a motion variation parameter vector and a structure variation parameter vector; A tension change detection model is constructed, and the first coated yarn area image, the second coated yarn area image and the change parameter set are input into the model to obtain a tension change value; the tension change detection model includes a spatial feature extraction network, a temporal feature extraction network, a change parameter feature extraction network and a fusion output network; the spatial feature extraction network extracts a hierarchical feature set based on the first coated yarn area image and the second coated yarn area image; the temporal feature extraction network obtains a temporal aggregation feature based on the hierarchical feature set; the change parameter feature extraction network obtains an enhanced change feature based on the change parameter set; the fusion output network outputs the tension change value based on the hierarchical feature set, the temporal aggregation feature and the enhanced change feature.
2. A method for detecting the tension of covered yarns in the sock forming production process according to claim 1, characterized in that: The time interval The settings meet the conditions ;in, Indicates the yarn feeding speed during the sock forming production process; Indicates the distance from the yarn feeding starting point to the weaving area; represents the minimum time interval threshold coefficient; Indicates the maximum time interval threshold coefficient.
3. The method for detecting the tension of the covering yarn in the sock forming production process according to claim 1, characterized in that: extract The covered yarn area image comprises: S1. Preprocessing the coated yarn image to obtain a preprocessed coated yarn image; the preprocessing includes: performing adaptive illumination compensation on the coated yarn image, using adaptive histogram equalization to enhance local contrast, and applying anisotropic diffusion filtering to eliminate noise; S2. Calculate the image gradient amplitude of the pre-processed coated yarn image using the Sobel operator to obtain an edge feature map; S3. Detecting a straight line according to the edge feature map, and selecting a marking point on the detected straight line; S4. Using the watershed algorithm, the image is segmented using the marked points as seed points to obtain an initial segmentation area; S5. Obtain the number of the initial segmented areas Perform verification and obtain The image of the covered yarn area; the verification processing step comprises: S51. If , perform region merging on the initial segmented regions until ; S52. If , perform region segmentation on the initial segmented region until ; S53. If , generating a mask for each of the initial segmented regions, extracting the pre-processed covered yarn image according to the mask An image of the covered yarn area.
4. A method for detecting the tension of covered yarns in the sock forming production process according to claim 3, characterized in that: The specific steps of performing region merging on the initial segmented regions include: S511. Constructing a region adjacency graph based on the initial segmented regions; S512. Calculate the merged scores of adjacent initial segmented regions; S513. Merging the adjacent initially segmented regions with the highest merging scores; S514. Update the initial segmentation area set and the number of the initial segmentation areas , return to step S521; The specific steps of performing region segmentation on the initial segmented region include: S521. Calculate the splitting index of each of the initial segmented regions; S522. Select the initial segmentation area with the largest split index as the candidate area, and set a counter ; S523. Segment the candidate region using a gradient suppression threshold to obtain a sub-region set; S524. Count the number of sub-regions that meet the constraints ,if , select the sub-region with the largest area among the sub-regions that meet the constraints as the new initial segmentation region and update the number of the initial segmentation regions , return to step S531; if and , adjust the gradient suppression threshold, and update the counter , return to step S533; if and , set the splitting index corresponding to the candidate region to 0, and return to step S532; represents the adjustment times threshold; the constraints include area constraint, aspect ratio constraint and linearity constraint.
5. The method for detecting the tension of the covering yarn in the sock forming production process according to claim 1, characterized in that: Extracting a set of variation parameters according to the first covered yarn area image and the second covered yarn area image comprises: Calculate the motion vector of the pixel point according to the first covered yarn area image and the second covered yarn area image to obtain an initial displacement field; According to the initial displacement field, a parameter feature pyramid is constructed to perform multi-scale decomposition and fusion to obtain a multi-scale fusion motion feature set; Extracting average displacement velocity, strain rate and average rotation angle according to the multi-scale fusion motion feature set to obtain the motion change parameter vector; Extract the covered yarn skeleton line according to the first covered yarn area image and the second covered yarn area image respectively, and sample the covered yarn skeleton line at equal intervals along the covered yarn skeleton line. points; Calculate the section width, minimum curvature, and maximum curvature at each sampling point; The cross-sectional width change rate, thickness uniformity change rate, shape change rate, Gaussian curvature change rate and average curvature change rate are calculated according to the cross-sectional width, the minimum curvature and the maximum curvature at each sampling point to obtain a structural change parameter vector.
6. The method for detecting the tension of the covering yarn in the sock forming production process according to claim 1, characterized in that: The spatial feature extraction network extracts the hierarchical feature set including: Construct an image feature pyramid to perform multi-scale decomposition and fusion on the first coated yarn area image and the second coated yarn area image to obtain an initial hierarchical feature set ;in, It indicates that the first coated yarn region image passes through the image feature pyramid The output of the layer; It indicates that the second coated yarn region image passes through the image feature pyramid The output of the layer; , Represents the number of layers of the image feature pyramid; Calculating a feature difference set between the first covered yarn region image and the second covered yarn region image according to the initial level feature set; Calculate an update weight set according to the feature difference set, and update the initial level feature set according to the update weight set to obtain the level feature set ;in, represents the first coated yarn area image obtained according to the first coated yarn area image Level features; Indicates that the first level features.
7. The method for detecting the tension of the covering yarn in the sock forming production process according to claim 1, characterized in that: The temporal feature extraction network calculates the temporal aggregation feature according to the hierarchical feature set, including: Extract hierarchical features from the hierarchical feature set and ,right Channel compression and position encoding are performed to obtain the first transformation feature map. Channel compression and position encoding are performed to obtain a second transformation feature map; wherein, represents the first coated yarn area image obtained according to the first coated yarn area image Level features; represents the first Level features; Expanding the first transformed feature map and the second transformed feature map respectively to obtain a first feature vector and a second feature vector; Calculate an association matrix based on the first eigenvector and the second eigenvector; Calculate row attention weights and column attention weights according to the association matrix; The first feature vector and the second feature vector are respectively feature weighted according to the row attention weight and the column attention weight, and are concatenated to obtain a temporal aggregation feature.
8. The method for detecting the tension of the covering yarn in the sock forming production process according to claim 1, characterized in that: The variation parameter feature extraction network obtains enhanced variation features according to the variation parameter set, including: The motion change parameter vector and the structure change parameter vector are concatenated and mapped to dimensional space, and obtain the characteristic vector of the changing parameters; A self-attention calculation is performed according to the change parameter feature vector to obtain the enhanced change feature.
9. The method for detecting the tension of the covering yarn in the sock forming production process according to claim 1, characterized in that: The fusion output network includes: Extract hierarchical features from the hierarchical feature set and , respectively and Perform global pooling and concatenate in the channel number dimension to obtain spatial aggregation features; Performing dimension transformation on the spatial aggregation feature, and weightedly fusing the dimensionally transformed spatial aggregation feature, the temporal aggregation feature, and the enhanced change feature through an attention mechanism to obtain a fused feature; Outputting a tension change value according to the fused feature.
10. The method for detecting the tension of the covering yarn in the sock forming production process according to claim 1, characterized in that: The loss function of the tension change detection model includes mean square error loss and smoothing loss, and the calculation formula of the loss function is: ; in, represents the loss function; represents the mean square error loss; represents the smoothing loss; represents the weight coefficient of the smoothing loss; Indicates The tension change value obtained by inputting a group of samples into the tension change detection model; Indicates The actual tension change value corresponding to the group samples; Indicates the sample size.
Citation Information
Patent Citations
Multimode fusion robot sewing method and system based on depth reinforcement learning
CN111633647A
Weft-knitted fabric classification method based on lightweight convolutional neural network
CN115861714A