Knitted fabric defect detection method and system based on machine vision
By constructing a multi-scale edge detection and region segmentation model, and analyzing defect edge data with the optical flow method, the problems of light changes and noise impact in the existing technology are solved, and efficient and accurate detection of defects in knitted fabrics are achieved.
Patent Information
- Application Number
- CN202411764182.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2044-12-04
AI Technical Summary
The existing machine vision knitted fabric defect detection system has unstable image quality when the lighting conditions and external noise change greatly, making it difficult to accurately identify small defects, and a single image processing algorithm is difficult to meet the needs of multiple defect detection.
By constructing a multi-scale edge detection model and region segmentation model, combining optical flow method to analyze defect edge data, dynamically adjust the threshold, and obtain the fractal dimensions of the scarf defect edge to evaluate its complexity.
Improves the adaptability and accuracy of edge detection, ensures accurate identification of defect areas in complex backgrounds, and improves the accuracy and efficiency of defect detection of knitted fabrics.
Smart Images

Figure CN119228805A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of knitted fabric defect detection, and in particular to a knitted fabric defect detection method and system based on machine vision. Background Art
[0002] With the continuous development of the textile industry, the production process of knitted fabrics such as scarves has also been significantly improved. However, in the production process of scarves, various defects often occur due to the influence of raw materials, production equipment, environmental factors and operators. These defects not only affect the appearance quality of the scarves, but also have a negative impact on the consumer's experience. Therefore, efficient and accurate defect detection of knitted fabrics such as scarves has become an important link that cannot be ignored in the textile manufacturing process.
[0003] In recent years, defect detection methods based on machine vision have gradually become a research hotspot in the field of textile inspection. The machine vision system can obtain the production process images of scarves in real time, and extract the edge features, texture information and defect areas through image processing algorithms to achieve fast and accurate detection of fabrics. However, the existing machine vision inspection systems still face some problems in practical applications. First, the lighting conditions and external noise in the knitted fabric production environment vary greatly, resulting in unstable quality of the collected images, affecting the accuracy and sensitivity of detection. Second, due to the complex structure of knitted fabrics, small defects (such as tiny broken threads or color differences) are difficult to be accurately identified, and different types of defects have different shapes and sizes. A single image processing algorithm is difficult to meet the needs of multiple defect detection. At present, many studies have proposed defect detection methods based on edge detection, image segmentation and image recognition technology. However, these methods usually rely on the analysis of static images, and there are still limitations in the detection of complex shapes and small defects.
[0004] Therefore, a knitted fabric defect detection method and system based on machine vision are proposed. Summary of the invention
[0005] The object of the present invention is to provide a knitted fabric defect detection method and system based on machine vision. Firstly, a first image set is obtained by collecting scarf production process data; a scarf multi-scale edge detection model is constructed to identify the first image set, and a threshold is dynamically adjusted according to the actual brightness and gradient distribution of the image to generate a first edge feature set; a background dynamic image and the first edge feature set are subjected to gradient information fusion, a scarf region segmentation model is constructed, and the scarf production real-time image is segmented to obtain a time-series segmentation image set and scarf defect edge data; the scarf defect edge data and the time-series segmentation image set are analyzed in real time to obtain scarf time-series edge defect trajectory data; a scarf defect edge complexity evaluation model is constructed to analyze the scarf time-series edge defect trajectory data, obtain the fractal dimension of the scarf defect edge, and generate the complexity of the scarf defect edge.
[0006] To achieve the above object, the present invention provides the following technical solutions: A knitted fabric defect detection method based on machine vision, comprising:
[0007] The production process data of the scarf is collected in real time by a high-resolution camera to obtain a first image set; the first image set includes a real-time image of the scarf production and a background dynamic image; Constructing a scarf multi-scale edge detection model to identify the first image set, obtaining the image brightness of standard image sets of different scales, dynamically adjusting the threshold according to the actual brightness and gradient distribution of the image, and generating a first edge feature set; The background dynamic image and the first edge feature set are subjected to gradient information fusion to construct a scarf region segmentation model; the scarf production real-time image is segmented by the scarf region segmentation model to obtain a time-series segmentation image set of different regions of the scarf and scarf defect edge data; Performing real-time analysis on the scarf defect edge data and the time-series segmented image set by an optical flow method to obtain scarf time-series edge defect trajectory data; A scarf defect edge complexity evaluation model is constructed to analyze the scarf temporal edge defect trajectory data. The fractal dimension of the scarf defect edge is obtained by comprehensively analyzing the trajectory change amplitude, trajectory smoothness and temporal continuity of the defect edge. The specific calculation formula of the fractal dimension of the scarf defect edge is: ; in, is the fractal dimension of the scarf defect edge, is a logarithmic function, is the fractal scale, For scale The number of divisions of the lower defect edge, is the trajectory variation coefficient of the defect edge, It is the trajectory smoothness index of the defect edge; Based on the fractal dimension of the scarf defect edge, the complexity of the scarf defect edge is obtained.
[0008] Preferably, the scarf multi-scale edge detection model includes a first image preprocessing layer, a multi-scale edge feature extraction layer and an edge feature map fusion layer; The first image preprocessing layer performs grayscale processing on the real-time images of scarf production in the first image set to obtain a first standard image set; and performs Gaussian filtering and smoothing processing on the first standard image set to obtain a second standard image set; The multi-scale edge feature extraction layer performs multi-scale processing on the second standard image set to obtain standard image sets of different scales; extracts features from the standard image sets of different scales according to an edge detection algorithm to generate an initial edge feature map; performs direction and intensity analysis on the initial edge feature map to obtain edge feature maps of different scales; The edge feature map fusion layer obtains a first edge feature set by enlarging the edge feature maps of different scales to the original image size in the first image set.
[0009] Preferably, the multi-scale processing is performed by performing Gaussian pyramid decomposition on the second standard image set of scarf production in real time to obtain standard image sets of different scales; The multi-scale edge detection algorithm obtains the image brightness of a standard image set of different scales; Obtaining high thresholds and low thresholds for images of different scales according to the image brightness; The edge features of different scales in the image are extracted according to the high threshold, the low threshold and the gradient strength of the image; the specific calculation formula of the edge detection algorithm is: ; in, is the edge image, is the horizontal edge, is the vertical edge, is the grayscale value of the input image, is the horizontal gradient, is the vertical gradient, is the high threshold of edge gradient strength, is the low threshold of edge gradient strength, is the mean value of the gradient strength, is the standard deviation of the gradient strength, is the weight of the mean gradient intensity, is the weight of the standard deviation of the gradient intensity, is the high threshold weight.
[0010] Preferably, the edge feature map fusion layer introduces a multi-scale fusion mechanism to fuse edge feature points extracted from different pixels by weighted gradient intensity; the calculation formula for weighted gradient intensity fusion is: ; in, It is the edge feature point after weighted fusion of gradient intensity of different pixels. is the fractal scale, is the number of scales, For the The weight of the scale, For the Scale image, For the Scale image, is a Gaussian filter.
[0011] Preferably, the scarf region segmentation model includes a second image preprocessing layer, a temporal boundary detection layer, a temporal region segmentation layer, a defect change analysis layer and a defect edge data extraction layer; The second image preprocessing layer generates a standard segmented image set by graying, denoising and contrast enhancing the real-time image of scarf production in the first image set; and obtains an initial defect change area by performing a differential operation on the image in the background dynamic image; The temporal boundary detection layer determines the scarf area and the non-scarf area by fusing the gradient information of the first edge feature set and the background dynamic image, and generates the boundary of the scarf temporal image area; The time series region segmentation layer identifies the boundaries of the scarf time series image regions to obtain a time series segmentation image set of different regions of the scarf; The defect change analysis layer obtains a first edge feature set to detect abnormal edge features in the dynamic change area by comparing the edge distribution pattern of the normal area; The defect edge data extraction layer obtains defect areas by sequentially segmenting the image set of different areas of the scarf; performs feature analysis on edge points of the defect area to generate scarf defect edge data; the scarf defect edge data includes defect edge coordinates and edge feature values.
[0012] Preferably, the temporal region segmentation layer performs fine segmentation on the scarf region by using a segmentation model energy function, and the energy function formula is: ; in, is the total energy of the split, is a pixel in the image, is the set of image pixels, is a logarithmic function, Pixels The characteristic value of Pixels The segmentation label, is the pixel feature value Belongs to the segmentation label The probability of are two adjacent pixels in the pixel neighborhood, is the set of all adjacent pixel pairs, To determine the pixel and Whether they belong to the same segmentation area, is an exponential function, Pixels The characteristic value of is the smoothing factor.
[0013] Preferably, defect edge pixel points extracted through the scarf defect edge data; Acquire the time variation information of each area of the scarf by segmenting the image set of different areas of the scarf in time series; Acquire the spatial coordinates of the defect edge based on the time variation information of the defect edge pixel points and each area of the scarf; The motion vector of each pixel is obtained based on the optical flow equation, and the temporal edge defect trajectory data of the scarf is generated.
[0014] A knitted fabric defect detection system based on machine vision, comprising: A data acquisition unit, used for collecting scarf production process data in real time through a high-resolution camera to obtain a first image set; the first image set includes a scarf production real-time image and a background dynamic image; An edge feature acquisition unit is used to construct a scarf multi-scale edge detection model to identify the first image set, acquire the image brightness of standard image sets of different scales, dynamically adjust the threshold according to the actual brightness and gradient distribution of the image, and generate a first edge feature set; An image segmentation unit is used to perform gradient information fusion on the background dynamic image and the first edge feature set to construct a scarf region segmentation model; segment the scarf production real-time image using the scarf region segmentation model to obtain a time-series segmentation image set of different scarf regions and scarf defect edge data; A defect track acquisition unit, used for performing real-time analysis on the scarf defect edge data and the time-series segmented image set by an optical flow method to obtain scarf time-series edge defect track data; The defect edge complexity acquisition unit is used to construct a scarf defect edge complexity evaluation model to analyze the scarf temporal edge defect trajectory data, and obtain the fractal dimension of the scarf defect edge by comprehensively analyzing the trajectory change amplitude, trajectory smoothness and temporal continuity of the defect edge; the specific calculation formula of the fractal dimension of the scarf defect edge is: ; in, is the fractal dimension of the scarf defect edge, is a logarithmic function, is the fractal scale, For scale The number of divisions of the lower defect edge, is the trajectory variation coefficient of the defect edge, It is the trajectory smoothness index of the defect edge; Based on the fractal dimension of the scarf defect edge, the complexity of the scarf defect edge is obtained.
[0015] Preferably, the scarf multi-scale edge detection model includes a first image preprocessing layer, a multi-scale edge feature extraction layer and an edge feature map fusion layer; The first image preprocessing layer performs grayscale processing on the real-time images of scarf production in the first image set to obtain a first standard image set; and performs Gaussian filtering and smoothing processing on the first standard image set to obtain a second standard image set; The multi-scale edge feature extraction layer performs multi-scale processing on the second standard image set to obtain standard image sets of different scales; extracts features from the standard image sets of different scales according to an edge detection algorithm to generate an initial edge feature map; performs direction and intensity analysis on the initial edge feature map to obtain edge feature maps of different scales; The edge feature map fusion layer obtains a first edge feature set by enlarging the edge feature maps of different scales to the original image size in the first image set.
[0016] Preferably, defect edge pixel points are extracted through the scarf defect edge data; time change information of each area of the scarf is obtained through the time-series segmentation image set of different areas of the scarf; the defect edge spatial coordinates are obtained based on the defect edge pixel points and the time change information of each area of the scarf; the motion vector of each pixel point is obtained based on the optical flow equation, and the scarf time-series edge defect trajectory data is generated.
[0017] Compared with the prior art, the present invention has the following beneficial effects: 1. The present invention constructs a scarf multi-scale edge detection model to identify the first image set and obtain a first edge feature set; a second standard image set is obtained by graying and Gaussian filtering the real-time image of scarf production in the first image set, multi-scale processing and feature extraction are performed on the second standard image set, edge features of different scales in the image are extracted according to the high threshold, the low threshold and the gradient intensity of the image, and the direction and intensity analysis are performed on the initial edge feature map to obtain edge feature maps of different scales; a dynamic adjustment parameter is introduced, and the threshold is dynamically adjusted according to the actual brightness and gradient distribution of the image, so that the edge detection is more adaptable to images under different lighting environments, a better continuous edge structure is formed, and the accuracy of the edge detection result is improved.
[0018] 2. The present invention constructs a scarf region segmentation model. First, gradient information is fused through the background dynamic image and the first edge feature set to generate the boundary of the scarf time-series image region. The initial accuracy of the segmentation model is improved by fusing the gradient information to ensure that the scarf region can still be accurately distinguished under a complex background; the boundary of the scarf time-series image region is identified to obtain a time-series segmentation image set of different regions of the scarf; and the time-series segmentation image set of different regions of the scarf is obtained to obtain the defect region; feature analysis is performed on the edge points of the defect region to generate scarf defect edge data, and region segmentation is combined with edge feature extraction to ensure the accuracy of the time-series segmentation image set in space and time.
[0019] 3. The present invention constructs a scarf defect edge complexity evaluation model to analyze the scarf temporal edge defect trajectory data, comprehensively analyzes the trajectory change amplitude, trajectory smoothness and temporal continuity of the defect edge, obtains the fractal dimension of the scarf defect edge, and specifically analyzes the dynamic change characteristics of the defect edge. By combining traditional fractal dimensions and dynamic characteristics, a stronger analysis effect is shown for irregular and rapidly changing defect edges, and the accuracy of scarf edge complexity evaluation is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 A schematic diagram of a process flow of a knitted fabric defect detection method based on machine vision provided by the present invention; Figure 2 A schematic diagram of the structure of a knitted fabric defect detection system based on machine vision provided by the present invention; Figure 3 A schematic diagram of the structure of a scarf multi-scale edge detection model provided by an embodiment of the present invention; Figure 4 A schematic diagram of the structure of a scarf region segmentation model provided in an embodiment of the present invention; Figure 5 A schematic diagram of scarf defects provided by an embodiment of the present invention.
[0021] Figure 5 Middle: 1. The scarf is pulled abnormally in some parts; 2. The scarf has frayed edges in some parts. DETAILED DESCRIPTION
[0022] 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.
[0023] The present invention provides a knitted fabric defect detection method based on machine vision. The method is applied to a knitted fabric defect detection system based on machine vision. The specific method flow chart and system structure diagram refer to Figure 1 and Figure 2 .
[0024] Embodiment 1 As an embodiment of the present invention, refer to Figure 1 S10 in the figure is applied to a data acquisition unit of a knitted fabric defect detection system based on machine vision. The data acquisition unit is used to collect scarf production process data in real time through a high-resolution camera to obtain a first image set; the first image set includes real-time scarf production images and background dynamic images.
[0025] On the scarf production line, when the knitting machine is running at high speed, the data acquisition unit collects the dynamic state of the knitted fabric through continuous shooting. If there is a broken stitch or uneven density in a certain frame of the image, it can be immediately acquired and recorded for subsequent classification and processing. At the same time, the analysis of the background dynamic image can reduce the increase in image noise caused by equipment vibration or light changes.
[0026] Reference Figure 1 S20 in the figure is applied to an edge feature acquisition unit of a knitted fabric defect detection system based on machine vision. The edge feature acquisition unit is used to construct a scarf multi-scale edge detection model to identify the first image set. By acquiring the image brightness of standard image sets of different scales, the threshold is dynamically adjusted according to the actual brightness and gradient distribution of the image to generate a first edge feature set.
[0027] Furthermore, the scarf multi-scale edge detection model includes a first image preprocessing layer, a multi-scale edge feature extraction layer and an edge feature map fusion layer, see Figure 3 ; The first image preprocessing layer obtains a first standard image set by graying the real-time images of scarf production in the first image set, and the graying process can simplify the image data, thereby highlighting the features of the scarf; the first standard image set is subjected to Gaussian filtering and smoothing to obtain a second standard image set, and this process can reduce random noise in the image and retain the image edge information; The multi-scale edge feature extraction layer obtains standard image sets of different scales by performing multi-scale processing on the second standard image set; extracts features from the standard image sets of different scales according to the edge detection algorithm to generate an initial edge feature map; performs direction and intensity analysis on the initial edge feature map to obtain edge feature maps of different scales; this step provides a resolution range from coarse to fine for edge detection, ensuring that defects of different sizes are detected.
[0028] The edge feature map fusion layer obtains a first edge feature set by enlarging the edge feature maps of different scales to the original image size in the first image set.
[0029] In this embodiment, the scarf multi-scale edge detection model includes a first image preprocessing layer, a multi-scale edge feature extraction layer and an edge feature map fusion layer, which improves the integrity of edge detection of real-time images of scarf production. The first image preprocessing layer effectively simplifies the image data through graying and Gaussian filtering smoothing, reducing the interference of random noise on the image. The multi-scale edge feature extraction layer combines multi-scale processing and edge detection algorithms to comprehensively extract different features of scarf fabrics from coarse to fine resolution ranges, ensuring that defects of different sizes and types are detected. The edge feature map fusion layer generates a unified edge feature set by amplifying and fusing multi-scale edge feature maps, avoiding information omission and redundancy, further improving the integrity and accuracy of detection, and achieving efficient and robust defect detection effects.
[0030] Furthermore, the multi-scale processing obtains standard image sets of different scales by performing Gaussian pyramid decomposition on the second standard image set of scarf production in real time; the specific formula of the standard image set of different scales is expressed as: ; in, For the Scale image, are the edge point coordinates, For the Scale image, is a Gaussian filter.
[0031] The multi-scale edge detection algorithm obtains the image brightness of a standard image set of different scales; Obtaining high thresholds and low thresholds for images of different scales according to the image brightness; The edge features of different scales in the image are extracted according to the high threshold, the low threshold and the gradient strength of the image; the specific calculation formula of the edge detection algorithm is: ; in, is the edge image, is the horizontal edge, is the numerical direction edge, is the grayscale value of the input image, is the horizontal gradient, is the vertical gradient, is the high threshold of edge gradient strength, is the low threshold of edge gradient strength, is the mean value of the gradient strength, is the standard deviation of the gradient strength, is the weight of the mean gradient intensity, is the weight of the standard deviation of the gradient intensity, is the high threshold weight.
[0032] In this embodiment, multi-scale processing is achieved through Gaussian pyramid decomposition, and standard image sets of different scales are effectively generated, which enhances the detection ability of defects of different sizes. The edge detection algorithm is used to dynamically adjust the high and low thresholds, and the weight distribution of gradient strength, mean and standard deviation is combined to extract accurate edge features, improve the sensitivity and robustness of detection, and significantly improve the recognition accuracy and reliability of knitted fabric defects.
[0033] Furthermore, the edge feature map fusion layer introduces a multi-scale fusion mechanism to weight the edge feature points extracted from different pixels according to the gradient intensity; the calculation formula for the gradient intensity weighted fusion is: ; in, It is the edge feature point after weighted fusion of gradient intensity of different pixels. is the number of scales, For the The weight of the scale.
[0034] The edge feature set generation: aggregate edge points at all scales to generate an edge feature set. The edge feature set is expressed as: ; in, is the edge feature set.
[0035] In this embodiment, the edge feature points of different pixels are weightedly fused according to the gradient intensity through a multi-scale fusion mechanism to ensure the significance of high-intensity feature points, effectively integrate key features at different scales, and enhance the system's ability to detect complex knitted fabric defects. Please refer to Table 1 for details.
[0036] Through the improved multi-scale edge detection model, a large number of edge feature points can be effectively extracted for different defect types of knitted fabrics; the number of edge points extracted by the multi-scale edge detection model reflects the detailed characteristics of the defect area; Figure 5 As shown, the local abnormal pulling of the scarf 1 reduces the density of edge points, while the local rough edges of the scarf 2 significantly increase the number of edge points.
[0037] The accuracy of edge feature points is above 97% through the proportion of extracted edge feature points that are consistent with the actual defect area, dynamic threshold adjustment and multi-scale fusion. In terms of detection accuracy, the optimization of multi-scale decomposition and edge feature fusion algorithms ensures the comprehensive analysis capability of edge features at different scales.
[0038] Table 1 Scarf defect detection data table
[0039] Through technologies such as grayscale, Gaussian pyramid decomposition, dynamic threshold adjustment and gradient intensity weighted fusion, the improved multi-scale edge detection model shows significant advantages in the accuracy of feature extraction and the efficiency of detection, effectively improving the integrity and accuracy of knitted fabric defect detection.
[0040] Reference Figure 1 S30 in the figure is applied to an image segmentation unit of a knitted fabric defect detection system based on machine vision, and the image segmentation unit is used to fuse the gradient information of the background dynamic image and the first edge feature set to construct a scarf area segmentation model; the real-time image of the scarf production is segmented by the scarf area segmentation model to obtain a time-series segmentation image set of different scarf areas and scarf defect edge data.
[0041] Furthermore, the scarf region segmentation model includes a second image preprocessing layer, a temporal boundary detection layer, a temporal region segmentation layer, a defect change analysis layer and a defect edge data extraction layer, see Figure 4 ; The second image preprocessing layer generates a standard segmented image set by graying, denoising and contrast enhancing the real-time image of scarf production in the first image set; and obtains an initial defect change area by performing a differential operation on the image in the background dynamic image; The temporal boundary detection layer determines the scarf area and the non-scarf area by fusing the gradient information of the first edge feature set and the background dynamic image, and generates the boundary of the scarf temporal image area; The time series region segmentation layer identifies the boundaries of the scarf time series image regions to obtain a time series segmentation image set of different regions of the scarf; The defect change analysis layer obtains a first edge feature set to detect abnormal edge features in the dynamic change area by comparing the edge distribution pattern of the normal area; The defect edge data extraction layer obtains defect areas by sequentially segmenting the image set of different areas of the scarf; performs feature analysis on edge points of the defect area to generate scarf defect edge data; the scarf defect edge data includes defect edge coordinates and edge feature values.
[0042] In this embodiment, the image segmentation unit realizes the accurate segmentation of the real-time image of scarf production through gradient information fusion and scarf region segmentation model. The second image preprocessing layer adopts graying, denoising and contrast enhancement technology to generate a standard segmentation image set and preliminarily detect the defect change area. The temporal boundary detection layer fuses the background dynamic image and the first edge feature set to accurately distinguish the scarf area from the non-scarf area, generate the temporal image boundary, and improve the accuracy of boundary recognition. The temporal region segmentation layer combines the segmentation boundary to realize the dynamic segmentation of different regions of the scarf, ensuring the temporal consistency and regional integrity of the segmentation results. The defect change analysis layer quickly locates the defect change area through dynamic abnormal edge feature comparison and analysis. The defect edge data extraction layer further extracts the edge coordinates and eigenvalues of the defect area, generates high-precision scarf defect edge data, and provides an accurate and reliable basis for defect detection and analysis, thereby improving the detection efficiency and reliability of knitted fabric defects.
[0043] Furthermore, the temporal region segmentation layer performs fine segmentation on the scarf region by using the segmentation model energy function, and the energy function formula is: ; in, is the total energy of the split, is a pixel in the image, is the set of image pixels, is a logarithmic function, Pixels The characteristic value of Pixels The segmentation label, is the pixel feature value Belongs to the segmentation label The probability of are two adjacent pixels in the pixel neighborhood, is the set of all adjacent pixel pairs, To determine the pixel and Whether they belong to the same segmentation area, is an exponential function, Pixels The characteristic value of is the smoothing factor.
[0044] By introducing the energy function of the segmentation model, the refined segmentation of the scarf area is achieved. The energy function comprehensively considers the probability relationship between the pixel feature value and the segmentation label, as well as the correlation between neighboring pixels, to ensure the accuracy and consistency of the segmentation results. The smoothness of the boundary of the segmented area is adjusted by the smoothing factor, which effectively reduces the segmentation error and noise interference.
[0045] Reference Figure 1 S40 in the embodiment is applied to a defect trajectory acquisition unit of a knitted fabric defect detection system based on machine vision, and the defect trajectory acquisition unit is used to perform real-time analysis on the scarf defect edge data and the time-series segmented image set by an optical flow method to obtain scarf time-series edge defect trajectory data.
[0046] Further, defect edge pixel points extracted through the scarf defect edge data; Acquire the time variation information of each area of the scarf by segmenting the image set of different areas of the scarf in time series; Acquire the spatial coordinates of the defect edge based on the time variation information of the defect edge pixel points and each area of the scarf; Based on the optical flow equation, the motion vector of each pixel is obtained to generate the scarf temporal edge defect trajectory data; The specific calculation formula of the optical flow equation is: ; in, is the horizontal gradient of the pixel, For pixels in The velocity component of the direction, is the vertical gradient of the pixel, For pixels in The velocity component of the direction, is the rate of change of the pixel in the time direction.
[0047] The present invention uses the optical flow method to perform real-time analysis on scarf defect edge data and time-series segmented image sets, thereby achieving the acquisition of scarf time-series edge defect trajectory data. The spatial coordinates of the defect edge are calculated by extracting the defect edge pixel points and combining the time-varying information of each region of the scarf. Based on the optical flow equation, the motion vector of the pixel point is obtained to form continuous and dynamic defect trajectory data. The temporal and spatial variation characteristics of the defect are fully reflected, the accuracy and robustness of defect positioning and trajectory tracking are effectively improved, and reliable data support is provided for the automatic monitoring and dynamic analysis of scarf knitted fabric defects.
[0048] Reference Figure 1 S50 in the figure is applied to a defect edge complexity acquisition unit of a knitted fabric defect detection system based on machine vision. The defect edge complexity acquisition unit is used to construct a scarf defect edge complexity evaluation model to analyze the scarf temporal edge defect trajectory data, and obtain the fractal dimension of the scarf defect edge by comprehensively analyzing the trajectory change amplitude, trajectory smoothness and temporal continuity of the defect edge. The specific calculation formula of the fractal dimension of the scarf defect edge is: ; in, is the fractal dimension of the scarf defect edge, is a logarithmic function, is the fractal scale, For scale The number of divisions of the lower defect edge, is the trajectory variation coefficient of the defect edge, It is the trajectory smoothness index of the defect edge; The trajectory variation coefficient of the defect edge and the trajectory smoothness index of the defect edge are: ; in, is the number of time-series segmentation frames, For scale Next The motion vector of the defect edge at a time point, is the angle between the defect edge trajectories at adjacent time points, reflecting the smoothness of the trajectory. is the fractal scale, which indicates the resolution or window size of image segmentation.
[0049] Based on the fractal dimension of the scarf defect edge, the complexity of the scarf defect edge is obtained.
[0050] The higher the complexity of the scarf defect edge, the more irregular the shape of the defect, the greater the trajectory change, the lower the smoothness, and the poorer the temporal coherence. It may be a serious process problem or mechanical failure in the scarf fabric production, which needs to be dealt with as a priority. The scarf defect edge with low complexity is a simple edge feature, which may be a slight error or local environmental interference, and has a relatively small impact on product quality. Through the complexity analysis, the defects are further classified and prioritized. See Table 2 for details.
[0051] The trajectory change amplitude coefficient indicates the change amplitude of the defect edge in the time series. The higher the value, the more drastic the dynamic change of the defect edge. The trajectory smoothness index is used to measure the smoothness of the defect edge trajectory. The lower the value, the more irregular the trajectory. The fractal dimension is used to comprehensively reflect the shape complexity of the defect edge, including the influence of factors such as trajectory change amplitude and smoothness. Complexity and priority Through the analysis of complexity, high-complexity holes and abnormal pulling are judged as high-priority defects, which need to be handled in time to prevent further affecting product quality. Low-complexity yarn breakage and medium-complexity burrs may be minor problems or environmental interferences, which have little impact on production; and high-priority defects need to be handled as soon as possible.
[0052] Table 2 Scarf defect priority
[0053] The present invention is a knitted fabric defect detection method based on machine vision. The image data in the scarf production process is collected in real time by a high-resolution camera, and the scarf edge features and defect information are extracted by combining a multi-scale edge detection model and gradient information fusion. The temporal segmentation of different regions of the scarf is realized by a regional segmentation model. At the same time, the motion trajectory of the defect edge is obtained by combining the optical flow method, and a complexity evaluation model is further constructed to quantify the defect characteristics, which significantly improves the accuracy and efficiency of defect detection. The method can analyze the dynamic changes in scarf production in real time, automatically identify and locate defect areas, generate quantifiable defect feature data, and provide strong support for intelligent production quality control.
[0054] Embodiment 2 In the modern textile industry, the production of knitted fabrics such as scarves has increasingly higher requirements for product quality, but due to the complex production process, diverse defect forms and limited manual detection efficiency, traditional detection methods are difficult to meet the needs of large-scale, high-quality production. Based on this, the present invention improves the accuracy and efficiency of detection through innovative detection methods and model design, providing strong support for quality control and automated production in the fabric production process.
[0055] The present invention also proposes a knitted fabric defect detection system using machine vision technology, such as Figure 2 As shown, including: A data acquisition unit, used for collecting scarf production process data in real time through a high-resolution camera to obtain a first image set; the first image set includes a scarf production real-time image and a background dynamic image; An edge feature acquisition unit is used to construct a scarf multi-scale edge detection model to identify the first image set, acquire the image brightness of standard image sets of different scales, dynamically adjust the threshold according to the actual brightness and gradient distribution of the image, and generate a first edge feature set; An image segmentation unit is used to perform gradient information fusion on the background dynamic image and the first edge feature set to construct a scarf region segmentation model; segment the scarf production real-time image using the scarf region segmentation model to obtain a time-series segmentation image set of different scarf regions and scarf defect edge data; A defect track acquisition unit, used for performing real-time analysis on the scarf defect edge data and the time-series segmented image set by an optical flow method to obtain scarf time-series edge defect track data; The defect edge complexity acquisition unit is used to construct a scarf defect edge complexity evaluation model to analyze the scarf temporal edge defect trajectory data, and obtain the fractal dimension of the scarf defect edge by comprehensively analyzing the trajectory change amplitude, trajectory smoothness and temporal continuity of the defect edge; the specific calculation formula of the fractal dimension of the scarf defect edge is: ; in, is the fractal dimension of the scarf defect edge, is a logarithmic function, is the fractal scale, For scale The number of divisions of the lower defect edge, is the trajectory variation coefficient of the defect edge, It is the trajectory smoothness index of the defect edge; Based on the fractal dimension of the scarf defect edge, the complexity of the scarf defect edge is obtained.
[0056] Furthermore, the scarf multi-scale edge detection model includes a first image preprocessing layer, a multi-scale edge feature extraction layer and an edge feature map fusion layer; The first image preprocessing layer performs grayscale processing on the real-time images of scarf production in the first image set to obtain a first standard image set; and performs Gaussian filtering and smoothing processing on the first standard image set to obtain a second standard image set; The multi-scale edge feature extraction layer performs multi-scale processing on the second standard image set to obtain standard image sets of different scales; extracts features from the standard image sets of different scales according to an edge detection algorithm to generate an initial edge feature map; performs direction and intensity analysis on the initial edge feature map to obtain edge feature maps of different scales; The edge feature map fusion layer obtains a first edge feature set by enlarging the edge feature maps of different scales to the original image size in the first image set.
[0057] Furthermore, defect edge pixel points are extracted through the scarf defect edge data; time change information of each area of the scarf is obtained through the time-series segmentation image set of different areas of the scarf; the defect edge spatial coordinates are obtained based on the defect edge pixel points and the time change information of each area of the scarf; the motion vector of each pixel point is obtained based on the optical flow equation, and the scarf time-series edge defect trajectory data is generated.
[0058] 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 knitted fabric defect detection method based on machine vision, characterized in that: include: The production process data of the scarf is collected in real time by a high-resolution camera to obtain a first image set; the first image set includes a real-time image of the scarf production and a background dynamic image; Constructing a scarf multi-scale edge detection model to identify the first image set, obtaining the image brightness of standard image sets of different scales, dynamically adjusting the threshold according to the actual brightness and gradient distribution of the image, and generating a first edge feature set; The background dynamic image and the first edge feature set are subjected to gradient information fusion to construct a scarf region segmentation model; the scarf production real-time image is segmented by the scarf region segmentation model to obtain a time-series segmentation image set of different regions of the scarf and scarf defect edge data; Performing real-time analysis on the scarf defect edge data and the time-series segmented image set by an optical flow method to obtain scarf time-series edge defect trajectory data; A scarf defect edge complexity evaluation model is constructed to analyze the scarf temporal edge defect trajectory data. The fractal dimension of the scarf defect edge is obtained by comprehensively analyzing the trajectory change amplitude, trajectory smoothness and temporal continuity of the defect edge. The specific calculation formula of the fractal dimension of the scarf defect edge is: ; in, is the fractal dimension of the scarf defect edge, is a logarithmic function, is the fractal scale, For scale The number of divisions of the lower defect edge, is the trajectory variation coefficient of the defect edge, It is the trajectory smoothness index of the defect edge; Based on the fractal dimension of the scarf defect edge, the complexity of the scarf defect edge is obtained.
2. The method for detecting knitted fabric defects based on machine vision according to claim 1, characterized in that: The scarf multi-scale edge detection model includes a first image preprocessing layer, a multi-scale edge feature extraction layer and an edge feature map fusion layer; The first image preprocessing layer performs grayscale processing on the real-time images of scarf production in the first image set to obtain a first standard image set; and performs Gaussian filtering and smoothing processing on the first standard image set to obtain a second standard image set; The multi-scale edge feature extraction layer performs multi-scale processing on the second standard image set to obtain standard image sets of different scales; extracts features from the standard image sets of different scales according to an edge detection algorithm to generate an initial edge feature map; performs direction and intensity analysis on the initial edge feature map to obtain edge feature maps of different scales; The edge feature map fusion layer obtains a first edge feature set by enlarging the edge feature maps of different scales to the original image size in the first image set.
3. The knitted fabric defect detection method based on machine vision according to claim 2, characterized in that: The multi-scale processing obtains standard image sets of different scales by performing Gaussian pyramid decomposition on the second standard image set of scarf production in real time; The multi-scale edge detection algorithm obtains the image brightness of a standard image set of different scales; Obtaining high thresholds and low thresholds for images of different scales according to the image brightness; The edge features of different scales in the image are extracted according to the high threshold, the low threshold and the gradient strength of the image; the specific calculation formula of the edge detection algorithm is: ; in, is the edge image, is the horizontal edge, is the vertical edge, is the grayscale value of the input image, is the horizontal gradient, is the vertical gradient, is the high threshold of edge gradient strength, is the low threshold of edge gradient strength, is the mean value of the gradient strength, is the standard deviation of the gradient strength, is the weight of the mean gradient intensity, is the weight of the standard deviation of the gradient intensity, is the high threshold weight.
4. The knitted fabric defect detection method based on machine vision according to claim 1, characterized in that: The edge feature map fusion layer introduces a multi-scale fusion mechanism to fuse edge feature points extracted from different pixels by weighted gradient intensity; the calculation formula for weighted gradient intensity fusion is: ; in, It is the edge feature point after weighted fusion of gradient intensity of different pixels. is the fractal scale, is the number of scales, For the The weight of the scale, For the Scale image, For the Scale image, is a Gaussian filter.
5. The knitted fabric defect detection method based on machine vision according to claim 1, characterized in that: The scarf region segmentation model includes a second image preprocessing layer, a temporal boundary detection layer, a temporal region segmentation layer, a defect change analysis layer and a defect edge data extraction layer; The second image preprocessing layer generates a standard segmented image set by graying, denoising and contrast enhancing the real-time image of scarf production in the first image set; and obtains an initial defect change area by performing a differential operation on the image in the background dynamic image; The temporal boundary detection layer determines the scarf area and the non-scarf area by fusing the gradient information of the first edge feature set and the background dynamic image, and generates the boundary of the scarf temporal image area; The time series region segmentation layer identifies the boundaries of the scarf time series image regions to obtain a time series segmentation image set of different regions of the scarf; The defect change analysis layer obtains a first edge feature set to detect abnormal edge features in the dynamic change area by comparing the edge distribution pattern of the normal area; The defect edge data extraction layer obtains defect areas by sequentially segmenting the image set of different areas of the scarf; performs feature analysis on edge points of the defect area to generate scarf defect edge data; the scarf defect edge data includes defect edge coordinates and edge feature values.
6. The method for detecting knitted fabric defects based on machine vision according to claim 5, characterized in that: The temporal region segmentation layer performs fine segmentation on the scarf region by using the segmentation model energy function, and the energy function formula is: ; in, is the total energy of the split, is a pixel in the image, is the set of image pixels, is a logarithmic function, Pixels The characteristic value of Pixels The segmentation label, is the pixel feature value Belongs to the segmentation label The probability of are two adjacent pixels in the pixel neighborhood, is the set of all adjacent pixel pairs, To determine the pixel and Whether they belong to the same segmentation area, is an exponential function, Pixels The characteristic value of is the smoothing factor.
7. The knitted fabric defect detection method based on machine vision according to claim 1, characterized in that: Defect edge pixel points extracted from the scarf defect edge data; Acquire the time variation information of each area of the scarf by segmenting the image set of different areas of the scarf in time series; Acquire the spatial coordinates of the defect edge based on the time variation information of the defect edge pixel points and each area of the scarf; The motion vector of each pixel is obtained based on the optical flow equation, and the temporal edge defect trajectory data of the scarf is generated.
8. A knitted fabric defect detection system based on machine vision, characterized in that: include: A data acquisition unit, used for collecting scarf production process data in real time through a high-resolution camera to obtain a first image set; the first image set includes a scarf production real-time image and a background dynamic image; An edge feature acquisition unit is used to construct a scarf multi-scale edge detection model to identify the first image set, acquire the image brightness of standard image sets of different scales, dynamically adjust the threshold according to the actual brightness and gradient distribution of the image, and generate a first edge feature set; An image segmentation unit is used to perform gradient information fusion on the background dynamic image and the first edge feature set to construct a scarf region segmentation model; segment the scarf production real-time image using the scarf region segmentation model to obtain a time-series segmentation image set of different scarf regions and scarf defect edge data; A defect track acquisition unit, used for performing real-time analysis on the scarf defect edge data and the time-series segmented image set by an optical flow method to obtain scarf time-series edge defect track data; The defect edge complexity acquisition unit is used to construct a scarf defect edge complexity evaluation model to analyze the scarf temporal edge defect trajectory data, and obtain the fractal dimension of the scarf defect edge by comprehensively analyzing the trajectory change amplitude, trajectory smoothness and temporal continuity of the defect edge; the specific calculation formula of the fractal dimension of the scarf defect edge is: ; in, is the fractal dimension of the scarf defect edge, is a logarithmic function, is the fractal scale, For scale The number of divisions of the lower defect edge, is the trajectory variation coefficient of the defect edge, It is the trajectory smoothness index of the defect edge; Based on the fractal dimension of the scarf defect edge, the complexity of the scarf defect edge is obtained.
9. The knitted fabric defect detection system based on machine vision according to claim 8, characterized in that: The scarf multi-scale edge detection model includes a first image preprocessing layer, a multi-scale edge feature extraction layer and an edge feature map fusion layer; The first image preprocessing layer performs grayscale processing on the real-time images of scarf production in the first image set to obtain a first standard image set; and performs Gaussian filtering and smoothing processing on the first standard image set to obtain a second standard image set; The multi-scale edge feature extraction layer performs multi-scale processing on the second standard image set to obtain standard image sets of different scales; extracts features from the standard image sets of different scales according to an edge detection algorithm to generate an initial edge feature map; performs direction and intensity analysis on the initial edge feature map to obtain edge feature maps of different scales; The edge feature map fusion layer obtains a first edge feature set by enlarging the edge feature maps of different scales to the original image size in the first image set.
10. The knitted fabric defect detection system based on machine vision according to claim 8, characterized in that: Defective edge pixel points are extracted through the scarf defect edge data; time change information of each area of the scarf is obtained through the time-series segmentation image set of different areas of the scarf; the defect edge spatial coordinates are obtained based on the defect edge pixel points and the time change information of each area of the scarf; the motion vector of each pixel point is obtained based on the optical flow equation, and the scarf time-series edge defect trajectory data is generated.
Citation Information
Patent Citations
Method for automatically detecting and classifying textile flaws based on pattern recognition and image processing
CN102879401A
Fabric flaw detection method based on wavelet transformation and genetic algorithm
CN105931246A
Spinning cake side surface defect identification method based on textural features
CN110415222A
Non-woven fabric flaw detection and classification method and system based on machine vision
CN113554080A
Contour extraction method based on monocular digital image
CN115100226A
Cited By
Dacron fabric defect detection method and system based on visual image
CN119648691A
Defect identification and early warning system in additive manufacturing process
CN119941737A
Concrete panel dam face crack identification system based on time-space correlation
CN120031803A
A concrete panel dam surface crack identification system based on spatiotemporal correlation
CN120031803B
Printing piece flaw detection method and system based on machine vision
CN120334236A